Skip to content

Commit 69d3a0a

Browse files
committed
add/update tests
1 parent 2d29764 commit 69d3a0a

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

test/cli/inline-suppress_test.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,20 @@ def test_2():
5555
assert ret == 0, stdout
5656

5757

58+
def test_xml():
59+
args = [
60+
'-q',
61+
'--template=simple',
62+
'--inline-suppr',
63+
'--xml-version=3',
64+
'proj-inline-suppress'
65+
]
66+
ret, stdout, stderr = cppcheck(args, cwd=__script_dir)
67+
assert '<suppression errorId="some_warning_id" fileName="proj-inline-suppress/2.c" lineNumber="2" inline="true" comment="there should be a unmatchedSuppression warning about this" />' in stderr
68+
assert stdout == ''
69+
assert ret == 0, stdout
70+
71+
5872
def test_unmatched_suppression():
5973
args = [
6074
'-q',

test/cli/premium_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_misra_c_builtin_style_checks(tmpdir):
6969

7070
exitcode, _, stderr = cppcheck(['--xml-version=3', '--suppress=foo', test_file], cppcheck_exe=exe)
7171
assert exitcode == 0
72-
assert '<suppression errorId="foo" />' in stderr
72+
assert '<suppression errorId="foo" inline="false" />' in stderr
7373

7474

7575
def test_build_dir_hash_cppcheck_product(tmpdir):

test/testsuppressions.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,17 @@ class TestSuppressions : public TestFixture {
10141014
msg.clear();
10151015
ASSERT_EQUALS(true, s.parseComment("/* cppcheck-suppress id */", &msg));
10161016
ASSERT_EQUALS("", msg);
1017+
ASSERT_EQUALS("", s.extraComment);
1018+
1019+
msg.clear();
1020+
ASSERT_EQUALS(true, s.parseComment("/* cppcheck-suppress id ; extra */", &msg));
1021+
ASSERT_EQUALS("", msg);
1022+
ASSERT_EQUALS("extra", s.extraComment);
1023+
1024+
msg.clear();
1025+
ASSERT_EQUALS(true, s.parseComment("/* cppcheck-suppress id // extra */", &msg));
1026+
ASSERT_EQUALS("", msg);
1027+
ASSERT_EQUALS("extra", s.extraComment);
10171028

10181029
msg.clear();
10191030
ASSERT_EQUALS(true, s.parseComment("/* cppcheck-suppress-file id */", &msg));

0 commit comments

Comments
 (0)