Skip to content

Commit ee18cad

Browse files
committed
Add test for #14372
1 parent e06e98f commit ee18cad

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

test/cli/other_test.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4402,3 +4402,30 @@ def test_ctu_function_call_path_slash(tmp_path): # #14591
44024402
file = function_call_paths[0].attrib['file']
44034403
assert file
44044404
assert not '\\' in file # the path was incorrectly converted to native
4405+
4406+
4407+
def test_inline_suppr_builddir_twice(tmp_path):
4408+
test_file = tmp_path / 'test.c'
4409+
with open(test_file, 'wt') as f:
4410+
f.write("""
4411+
// cppcheck-suppress-begin [zerodiv]
4412+
x = 10 / 0;
4413+
// cppcheck-suppress-end [zerodiv]
4414+
""")
4415+
4416+
build_dir = tmp_path / 'b'
4417+
os.mkdir(build_dir)
4418+
4419+
args = [
4420+
'-q',
4421+
'--cppcheck-build-dir={}'.format(build_dir),
4422+
'--enable=all',
4423+
'--inline-suppr',
4424+
str(test_file)
4425+
]
4426+
4427+
for i in range(2):
4428+
exitcode, stdout, stderr = cppcheck(args)
4429+
assert exitcode == 0
4430+
assert stdout == ''
4431+
assert stderr == ''

0 commit comments

Comments
 (0)