From 1fdae247b314ed63f923be591da6f45a8d6090fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 17 Aug 2019 17:49:22 +0200 Subject: [PATCH] test/cli: ensure that there is unmatchedSuppression warning --- test/cli/proj-inline-suppress/1.c | 3 +++ test/cli/test-inline-suppress.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/test/cli/proj-inline-suppress/1.c b/test/cli/proj-inline-suppress/1.c index 484aeee6d..440fbf7cf 100644 --- a/test/cli/proj-inline-suppress/1.c +++ b/test/cli/proj-inline-suppress/1.c @@ -1,2 +1,5 @@ #include <1.h> +// cppcheck-suppress some_warning_id ; there should be a unmatchedSuppression warning about this +x; + diff --git a/test/cli/test-inline-suppress.py b/test/cli/test-inline-suppress.py index 31dad1ab1..eab10467b 100644 --- a/test/cli/test-inline-suppress.py +++ b/test/cli/test-inline-suppress.py @@ -15,3 +15,7 @@ def test2(): assert ret == 0 assert len(stderr) > 0 +def test_unmatched_suppression(): + ret, stdout, stderr = cppcheck(['--inline-suppr', '--enable=information', '--error-exitcode=1', 'proj-inline-suppress']) + assert ret == 1 + assert 'Unmatched suppression: some_warning_id' in stderr