Skip to content

Commit f6b3046

Browse files
committed
test/cli/other_test.py: test --rule with multiple input files
1 parent 14fe4b9 commit f6b3046

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

test/cli/other_test.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,27 @@ def test_rule(tmpdir):
15761576
]
15771577

15781578

1579+
def test_rule_multiple_files(tmpdir):
1580+
stderr_exp = []
1581+
for i in range(10):
1582+
test_file = os.path.join(tmpdir, f'test_{i}.c')
1583+
stderr_exp.append("{}:4:0: style: found 'f' [rule]".format(test_file))
1584+
with open(test_file, 'wt') as f:
1585+
f.write('''
1586+
#define DEF_1
1587+
#define DEF_2
1588+
void f() { }
1589+
''')
1590+
1591+
exitcode, stdout, stderr = cppcheck(['-q', '--template=simple', '--rule=f', str(tmpdir)])
1592+
assert exitcode == 0, stdout if stdout else stderr
1593+
assert stdout.splitlines() == []
1594+
lines = stderr.splitlines()
1595+
lines.sort()
1596+
stderr_exp.sort()
1597+
assert lines == stderr_exp
1598+
1599+
15791600
def test_filelist(tmpdir):
15801601
list_dir = os.path.join(tmpdir, 'list-dir')
15811602
os.mkdir(list_dir)

0 commit comments

Comments
 (0)