Skip to content

Commit 342e8c9

Browse files
committed
add test in test/cli/dumpfile_test.py
1 parent e381355 commit 342e8c9

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

test/cli/dumpfile_test.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,29 @@ def test_language_unk_force_c(tmp_path):
9292

9393

9494
def test_language_unk_force_cpp(tmp_path):
95-
__test_language(tmp_path, 'src', force_lang='c++', exp_lang='cpp')
95+
__test_language(tmp_path, 'src', force_lang='c++', exp_lang='cpp')
96+
97+
98+
def test_duplicate_file_entries(tmpdir): #13333
99+
test_file = str(tmpdir / 'test.c')
100+
with open(test_file, 'wt') as f:
101+
f.write('x=1;\n')
102+
103+
project_file = str(tmpdir / 'compile_commands.json')
104+
with open(project_file, 'wt') as f:
105+
f.write("""[{
106+
"file": "test_file" ,
107+
"directory": "tmpdir",
108+
"command": "cc -c test.c"
109+
},{
110+
"file": "test_file" ,
111+
"directory": "tmpdir",
112+
"command": "cc -c test.c"
113+
}]""".replace('test_file', test_file).replace('tmpdir', str(tmpdir)))
114+
115+
args = ['--project=compile_commands.json', '--dump']
116+
_, _, _ = cppcheck(args, cwd=str(tmpdir))
117+
118+
assert os.path.isfile(test_file + '.dump')
119+
assert os.path.isfile(test_file + '.1.dump')
120+

0 commit comments

Comments
 (0)