From 6a87fb4c4c23d2e0b8832744565e007a9ff218de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Sun, 29 Mar 2026 13:19:06 +0200 Subject: [PATCH] Add test for #14372 --- test/cli/other_test.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/cli/other_test.py b/test/cli/other_test.py index 26dcca81ec1..29fd667a31b 100644 --- a/test/cli/other_test.py +++ b/test/cli/other_test.py @@ -4402,3 +4402,31 @@ def test_ctu_function_call_path_slash(tmp_path): # #14591 file = function_call_paths[0].attrib['file'] assert file assert not '\\' in file # the path was incorrectly converted to native + + +# TODO: Remove duplication/builddir when 7079 is merged +def test_inline_block_suppr_builddir_twice(tmp_path): + test_file = tmp_path / 'test.c' + with open(test_file, 'wt') as f: + f.write(""" +// cppcheck-suppress-begin [zerodiv] +x = 10 / 0; +// cppcheck-suppress-end [zerodiv] +""") + + build_dir = tmp_path / 'b' + os.mkdir(build_dir) + + args = [ + '-q', + '--cppcheck-build-dir={}'.format(build_dir), + '--enable=all', + '--inline-suppr', + str(test_file) + ] + + for _ in range(2): + exitcode, stdout, stderr = cppcheck(args) + assert exitcode == 0 + assert stdout == '' + assert stderr == ''