Skip to content

Commit a9570ae

Browse files
committed
add test for .cppcheck files
1 parent cd4ff8a commit a9570ae

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

test/cli/proj2_test.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_absolute_path(tmp_path):
8585
assert stdout.find('Checking %s ...' % file1) >= 0
8686
assert stdout.find('Checking %s ...' % file2) >= 0
8787

88-
def test_progress():
88+
def test_progress_json():
8989
size1 = os.path.getsize(os.path.join(__proj_dir, 'a', 'a.c'))
9090
size2 = os.path.getsize(os.path.join(__proj_dir, 'b', 'b.c'))
9191
perc1 = 100 * size1 // (size1 + size2)
@@ -96,6 +96,17 @@ def test_progress():
9696
assert stdout.find('1/2 files checked %d%% done' % perc1) >= 0 or stdout.find('1/2 files checked %d%% done' % perc2) >= 0
9797
assert stdout.find('2/2 files checked 100% done') >= 0
9898

99+
def test_progress_cppcheck():
100+
size1 = os.path.getsize(os.path.join(__proj_dir, 'a', 'a.c'))
101+
size2 = os.path.getsize(os.path.join(__proj_dir, 'b', 'b.c'))
102+
perc1 = 100 * size1 // (size1 + size2)
103+
perc2 = 100 * size2 // (size1 + size2)
104+
__create_compile_commands()
105+
ret, stdout, _ = cppcheck(['--project=proj2/proj2.cppcheck'], cwd=__script_dir)
106+
assert ret == 0, stdout
107+
assert stdout.find('1/2 files checked %d%% done' % perc1) >= 0 or stdout.find('1/2 files checked %d%% done' % perc2) >= 0
108+
assert stdout.find('2/2 files checked 100% done') >= 0
109+
99110
def test_gui_project_loads_compile_commands_1(tmp_path):
100111
proj_dir = tmp_path / 'proj2'
101112
shutil.copytree(__proj_dir, proj_dir)

0 commit comments

Comments
 (0)