Skip to content

Commit

Permalink
Add test for JSON output
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser committed Jun 24, 2024
1 parent 59296eb commit 1e2ca10
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions crates/ruff/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,35 @@ fn show_statistics() {
"###);
}

#[test]
fn show_statistics_json() {
let mut cmd = RuffCheck::default()
.args([
"--select",
"F401",
"--statistics",
"--output-format",
"json",
])
.build();
assert_cmd_snapshot!(cmd
.pass_stdin("import sys\nimport os\n\nprint(os.getuid())\n"), @r###"
success: false
exit_code: 1
----- stdout -----
[
{
"code": "F401",
"name": "unused-import",
"count": 1,
"fixable": true
}
]
----- stderr -----
"###);
}

#[test]
fn nursery_prefix() {
// Should only detect RUF90X, but not the unstable test rules
Expand Down

0 comments on commit 1e2ca10

Please sign in to comment.