From e8c0345a51724e08d009d4bc4ad91ec2548e2cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 3 May 2019 20:19:28 +0200 Subject: [PATCH] Fixed #7999 (Inline suppressions do not work under weird circumstances) --- test/cli/proj-inline-suppress/1.c | 2 ++ test/cli/proj-inline-suppress/1.h | 5 +++++ test/cli/test-inline-suppress.py | 17 +++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 test/cli/proj-inline-suppress/1.c create mode 100644 test/cli/proj-inline-suppress/1.h create mode 100644 test/cli/test-inline-suppress.py diff --git a/test/cli/proj-inline-suppress/1.c b/test/cli/proj-inline-suppress/1.c new file mode 100644 index 000000000..484aeee6d --- /dev/null +++ b/test/cli/proj-inline-suppress/1.c @@ -0,0 +1,2 @@ +#include <1.h> + diff --git a/test/cli/proj-inline-suppress/1.h b/test/cli/proj-inline-suppress/1.h new file mode 100644 index 000000000..9ca29fb80 --- /dev/null +++ b/test/cli/proj-inline-suppress/1.h @@ -0,0 +1,5 @@ + +// cppcheck-suppress zerodiv +const int x = 10000 / 0; + + diff --git a/test/cli/test-inline-suppress.py b/test/cli/test-inline-suppress.py new file mode 100644 index 000000000..090ef1199 --- /dev/null +++ b/test/cli/test-inline-suppress.py @@ -0,0 +1,17 @@ + +# python -m pytest test-inline-suppress.py + +import os +import re +from testutils import cppcheck + +def test1(): + ret, stdout, stderr = cppcheck('--inline-suppr proj-inline-suppress') + assert ret == 0 + assert len(stderr) == 0 + +def test2(): + ret, stdout, stderr = cppcheck('proj-inline-suppress') + assert ret == 0 + assert len(stderr) > 0 +