Skip to content

Commit c6876a2

Browse files
committed
test/cli/more-projects_test.py: added test show
1 parent b4ff60a commit c6876a2

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

test/cli/more-projects_test.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,3 +861,39 @@ def test_shared_items_project():
861861
# Assume no errors, and that shared items code files have been checked as well
862862
assert '2/2 files checked ' in stdout # only perform partial check since -j2 does not report a percentage right now
863863
assert stderr == ''
864+
865+
866+
def test_project_file_nested(tmp_path):
867+
test_file = tmp_path / 'test.c'
868+
with open(test_file, 'wt'):
869+
pass
870+
871+
level3_file = tmp_path / 'level3.cppcheck'
872+
with open(level3_file, 'wt') as f:
873+
f.write(
874+
"""<project>
875+
<paths>
876+
<dir name="{}"/>
877+
</paths>
878+
</project>""".format(test_file))
879+
880+
level2_file = tmp_path / 'level2.cppcheck'
881+
with open(level2_file, 'wt') as f:
882+
f.write(
883+
"""<project>
884+
<importproject>level3.cppcheck</importproject>
885+
</project>""".format(test_file))
886+
887+
level1_file = tmp_path / 'level1.cppcheck'
888+
with open(level1_file, 'wt') as f:
889+
f.write(
890+
"""<project>
891+
<importproject>level2.cppcheck</importproject>
892+
</project>""".format(test_file))
893+
894+
args = ['--project={}'.format(level1_file)]
895+
out_lines = [
896+
'cppcheck: error: no C or C++ source files found.'
897+
]
898+
899+
assert_cppcheck(args, ec_exp=1, err_exp=[], out_exp=out_lines)

0 commit comments

Comments
 (0)