Skip to content

Commit f6b31b7

Browse files
authored
Add test for #14372: Unmatched suppression reported for block suppression (danmar#8389)
1 parent 241cfcb commit f6b31b7

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

test/cli/other_test.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4402,3 +4402,31 @@ 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+
# TODO: Remove duplication/builddir when 7079 is merged
4408+
def test_inline_block_suppr_builddir_twice(tmp_path):
4409+
test_file = tmp_path / 'test.c'
4410+
with open(test_file, 'wt') as f:
4411+
f.write("""
4412+
// cppcheck-suppress-begin [zerodiv]
4413+
x = 10 / 0;
4414+
// cppcheck-suppress-end [zerodiv]
4415+
""")
4416+
4417+
build_dir = tmp_path / 'b'
4418+
os.mkdir(build_dir)
4419+
4420+
args = [
4421+
'-q',
4422+
'--cppcheck-build-dir={}'.format(build_dir),
4423+
'--enable=all',
4424+
'--inline-suppr',
4425+
str(test_file)
4426+
]
4427+
4428+
for _ in range(2):
4429+
exitcode, stdout, stderr = cppcheck(args)
4430+
assert exitcode == 0
4431+
assert stdout == ''
4432+
assert stderr == ''

0 commit comments

Comments
 (0)