Skip to content

Commit d695765

Browse files
committed
converted test_showtimetop5.sh into a Python test
1 parent 5a89705 commit d695765

3 files changed

Lines changed: 23 additions & 12 deletions

File tree

.github/workflows/CI-unixish.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,6 @@ jobs:
384384
env:
385385
STRICT: 1
386386

387-
- name: Run showtimetop5 tests
388-
run: |
389-
./tools/test_showtimetop5.sh
390-
391387
- name: Run --dump test
392388
run: |
393389
./cppcheck test/testpreprocessor.cpp --dump

test/cli/test-other.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,3 +531,26 @@ class A {
531531

532532
_, _, stderr = cppcheck(args)
533533
assert stderr == "{}:4:0: style: The function 'f' is never used. [unusedFunction]\n".format(test_h_file)
534+
535+
536+
# TODO: test with -j and all other types
537+
def test_showtime_top5_file(tmpdir):
538+
test_file = os.path.join(tmpdir, 'test.cpp')
539+
with open(test_file, 'wt') as f:
540+
f.write("""
541+
int main(int argc)
542+
{
543+
}
544+
""")
545+
546+
args = ['--showtime=top5_file', '--quiet', test_file]
547+
548+
exitcode, stdout, stderr = cppcheck(args)
549+
assert exitcode == 0 # TODO: needs to be 1
550+
lines = stdout.splitlines()
551+
assert len(lines) == 7
552+
assert lines[0] == ''
553+
for i in range(1, 5):
554+
assert lines[i].endswith(' - 1 result(s))')
555+
assert lines[6].startswith('Overall time:')
556+
assert stderr == ''

tools/test_showtimetop5.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)