From 07aef404ad0771e6990cf04c630bb407a932e33a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Wed, 26 Aug 2026 16:30:39 +0200 Subject: [PATCH] add test --- test/cli/dumpfile_test.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/cli/dumpfile_test.py b/test/cli/dumpfile_test.py index 932c4363a30..5dbb29f9e38 100644 --- a/test/cli/dumpfile_test.py +++ b/test/cli/dumpfile_test.py @@ -132,3 +132,17 @@ def test_container_methods(tmpdir): with open(dumpfile, 'rt') as f: dump = f.read() assert '' in dump + +def test_line_macro(tmpdir): + test_file = str(tmpdir / 'test.cpp') + with open(test_file, 'wt') as f: + f.write('#define MACRO() __LINE__\n') + f.write('int x = MACRO();\n') + + exitcode, _, stderr = cppcheck(['--dump', test_file]) + assert exitcode == 0, stderr + + dumpfile = test_file + '.dump' + with open(dumpfile, 'rt') as f: + dump = f.read() + assert 'type="number" isInt="true" macroName="__LINE__"' in dump