Testing backwards compatible inline suppression

This commit is contained in:
Daniel Marjamäki 2020-10-04 16:42:09 +02:00
parent c3517924d0
commit c3de128a5f
2 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,6 @@
// From forum: https://sourceforge.net/p/cppcheck/discussion/general/thread/e67653efdb/
void foo()
{ // cppcheck-suppress zerodiv
int x = 10000 / 0;
}

View File

@ -24,3 +24,10 @@ def test_unmatched_suppression_path_with_extra_stuf():
ret, stdout, stderr = cppcheck(['--inline-suppr', '--enable=information', '--error-exitcode=1', './proj-inline-suppress/2.c'])
assert ret == 1
assert 'Unmatched suppression: some_warning_id' in stderr
def test_backwards_compatibility():
ret, stdout, stderr = cppcheck(['proj-inline-suppress/3.cpp'])
assert '[zerodiv]' in stderr
ret, stdout, stderr = cppcheck(['--inline-suppr', 'proj-inline-suppress/3.cpp'])
assert stderr == ''