Commit 1e2ca10 1 parent 59296eb commit 1e2ca10 Copy full SHA for 1e2ca10
File tree 1 file changed +29
-0
lines changed
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -860,6 +860,35 @@ fn show_statistics() {
860
860
"### ) ;
861
861
}
862
862
863
+ #[ test]
864
+ fn show_statistics_json ( ) {
865
+ let mut cmd = RuffCheck :: default ( )
866
+ . args ( [
867
+ "--select" ,
868
+ "F401" ,
869
+ "--statistics" ,
870
+ "--output-format" ,
871
+ "json" ,
872
+ ] )
873
+ . build ( ) ;
874
+ assert_cmd_snapshot ! ( cmd
875
+ . pass_stdin( "import sys\n import os\n \n print(os.getuid())\n " ) , @r###"
876
+ success: false
877
+ exit_code: 1
878
+ ----- stdout -----
879
+ [
880
+ {
881
+ "code": "F401",
882
+ "name": "unused-import",
883
+ "count": 1,
884
+ "fixable": true
885
+ }
886
+ ]
887
+
888
+ ----- stderr -----
889
+ "### ) ;
890
+ }
891
+
863
892
#[ test]
864
893
fn nursery_prefix ( ) {
865
894
// Should only detect RUF90X, but not the unstable test rules
You can’t perform that action at this time.
0 commit comments