Skip to content

Commit 46369cc

Browse files
committed
add test for .cppcheck files
1 parent d6c866e commit 46369cc

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
@@ -73,7 +73,7 @@ def test_absolute_path():
7373
assert stdout.find('Checking %s ...' % file1) >= 0
7474
assert stdout.find('Checking %s ...' % file2) >= 0
7575

76-
def test_progress():
76+
def test_progress_json():
7777
size1 = os.path.getsize(os.path.join(__proj_dir, 'a', 'a.c'))
7878
size2 = os.path.getsize(os.path.join(__proj_dir, 'b', 'b.c'))
7979
perc1 = 100 * size1 // (size1 + size2)
@@ -84,6 +84,17 @@ def test_progress():
8484
assert stdout.find('1/2 files checked %d%% done' % perc1) >= 0 or stdout.find('1/2 files checked %d%% done' % perc2) >= 0
8585
assert stdout.find('2/2 files checked 100% done') >= 0
8686

87+
def test_progress_cppcheck():
88+
size1 = os.path.getsize(os.path.join(__proj_dir, 'a', 'a.c'))
89+
size2 = os.path.getsize(os.path.join(__proj_dir, 'b', 'b.c'))
90+
perc1 = 100 * size1 // (size1 + size2)
91+
perc2 = 100 * size2 // (size1 + size2)
92+
__create_compile_commands()
93+
ret, stdout, _ = cppcheck(['--project=proj2/proj2.cppcheck'], cwd=__script_dir)
94+
assert ret == 0, stdout
95+
assert stdout.find('1/2 files checked %d%% done' % perc1) >= 0 or stdout.find('1/2 files checked %d%% done' % perc2) >= 0
96+
assert stdout.find('2/2 files checked 100% done') >= 0
97+
8798
def test_gui_project_loads_compile_commands_1():
8899
__create_compile_commands()
89100
ret, stdout, _ = cppcheck(['--project=proj2/proj2.cppcheck'], cwd=__script_dir)

0 commit comments

Comments
 (0)