Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for files specified on command line
Browse files Browse the repository at this point in the history
ludviggunne committed Jan 4, 2025
1 parent c3a9e9c commit 2ddba93
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/cli/proj2_test.py
Original file line number Diff line number Diff line change
@@ -111,6 +111,20 @@ def test_progress_cppcheck(tmp_path):
assert stdout.find('1/2 files checked %d%% done' % perc1) >= 0 or stdout.find('1/2 files checked %d%% done' % perc2) >= 0
assert stdout.find('2/2 files checked 100% done') >= 0

def test_progress_cli(tmp_path):
proj_dir = tmp_path / 'proj2'
shutil.copytree(__proj_dir, proj_dir)
path1 = os.path.join(proj_dir, 'a', 'a.c')
path2 = os.path.join(proj_dir, 'b', 'b.c')
size1 = os.path.getsize(path1)
size2 = os.path.getsize(path2)
perc1 = 100 * size1 // (size1 + size2)
perc2 = 100 * size2 // (size1 + size2)
ret, stdout, _ = cppcheck([path1, path2], cwd=tmp_path)
assert ret == 0, stdout
assert stdout.find('1/2 files checked %d%% done' % perc1) >= 0 or stdout.find('1/2 files checked %d%% done' % perc2) >= 0
assert stdout.find('2/2 files checked 100% done') >= 0

def test_gui_project_loads_compile_commands_1(tmp_path):
proj_dir = tmp_path / 'proj2'
shutil.copytree(__proj_dir, proj_dir)

0 comments on commit 2ddba93

Please sign in to comment.