5
5
6
6
7
7
@pytest .mark .parametrize (
8
- ('args' , 'expected_retval' ), (
9
- (['--style=Google' ], (0 , "" )),
10
- (['--style=Google' , '--version=16' ], (0 , "" )),
11
- (['--style=Google' , '--version=17' ], (0 , "" )),
12
- (['--style=Google' , '--version=18' ], (0 , "" )),
13
- (['--style=Google' , '--version=19' ], (0 , "" )),
14
- (['--style=Google' , '--version=20' ], (0 , "" )),
8
+ ("args" , "expected_retval" ),
9
+ (
10
+ (["--style=Google" ], (0 , "" )),
11
+ (["--style=Google" , "--version=16" ], (0 , "" )),
12
+ (["--style=Google" , "--version=17" ], (0 , "" )),
13
+ (["--style=Google" , "--version=18" ], (0 , "" )),
14
+ (["--style=Google" , "--version=19" ], (0 , "" )),
15
+ (["--style=Google" , "--version=20" ], (0 , "" )),
15
16
),
16
17
)
17
18
def test_run_clang_format_valid (args , expected_retval , tmp_path ):
@@ -24,13 +25,19 @@ def test_run_clang_format_valid(args, expected_retval, tmp_path):
24
25
25
26
26
27
@pytest .mark .parametrize (
27
- ('args' , 'expected_retval' ), (
28
- (['--style=Google' ,], 1 ),
29
- (['--style=Google' , '--version=16' ], 1 ),
30
- (['--style=Google' , '--version=17' ], 1 ),
31
- (['--style=Google' , '--version=18' ], 1 ),
32
- (['--style=Google' , '--version=19' ], 1 ),
33
- (['--style=Google' , '--version=20' ], 1 ),
28
+ ("args" , "expected_retval" ),
29
+ (
30
+ (
31
+ [
32
+ "--style=Google" ,
33
+ ],
34
+ 1 ,
35
+ ),
36
+ (["--style=Google" , "--version=16" ], 1 ),
37
+ (["--style=Google" , "--version=17" ], 1 ),
38
+ (["--style=Google" , "--version=18" ], 1 ),
39
+ (["--style=Google" , "--version=19" ], 1 ),
40
+ (["--style=Google" , "--version=20" ], 1 ),
34
41
),
35
42
)
36
43
def test_run_clang_format_invalid (args , expected_retval , tmp_path ):
@@ -39,3 +46,21 @@ def test_run_clang_format_invalid(args, expected_retval, tmp_path):
39
46
40
47
ret , _ = run_clang_format (args + [str (test_file )])
41
48
assert ret == expected_retval
49
+
50
+
51
+ @pytest .mark .parametrize (
52
+ ("args" , "expected_retval" ),
53
+ (
54
+ (
55
+ [
56
+ "--style=Google" ,
57
+ ],
58
+ 1 ,
59
+ ),
60
+ ),
61
+ )
62
+ def test_run_clang_format_dry_run (args , expected_retval , tmp_path ):
63
+ # copy test file to tmp_path to prevent modifying repo data
64
+ test_file = tmp_path / "main.c"
65
+ ret , _ = run_clang_format (["--dry-run" , str (test_file )])
66
+ assert ret == - 1 # Dry run should not fail
0 commit comments