diff --git a/test/cli/proj-inline-suppress/3.cpp b/test/cli/proj-inline-suppress/3.cpp new file mode 100644 index 000000000..7ecd1c0e8 --- /dev/null +++ b/test/cli/proj-inline-suppress/3.cpp @@ -0,0 +1,6 @@ +// From forum: https://sourceforge.net/p/cppcheck/discussion/general/thread/e67653efdb/ +void foo() +{ // cppcheck-suppress zerodiv + int x = 10000 / 0; +} + diff --git a/test/cli/test-inline-suppress.py b/test/cli/test-inline-suppress.py index 9b4102d2e..d570f27f5 100644 --- a/test/cli/test-inline-suppress.py +++ b/test/cli/test-inline-suppress.py @@ -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 == ''