@@ -48,7 +48,10 @@ class TestSuppressions : public TestFixture
4848 Settings settings;
4949 settings._inlineSuppressions = true ;
5050 if (!suppression.empty ())
51- settings.nomsg .addSuppressionLine (suppression);
51+ {
52+ std::string r = settings.nomsg .addSuppressionLine (suppression);
53+ ASSERT_EQUALS (" " , r);
54+ }
5255
5356 CppCheck cppCheck (*this , true );
5457 cppCheck.settings (settings);
@@ -75,7 +78,10 @@ class TestSuppressions : public TestFixture
7578 settings._jobs = 1 ;
7679 settings._inlineSuppressions = true ;
7780 if (!suppression.empty ())
78- settings.nomsg .addSuppressionLine (suppression);
81+ {
82+ std::string r = settings.nomsg .addSuppressionLine (suppression);
83+ ASSERT_EQUALS (" " , r);
84+ }
7985 ThreadExecutor executor (filenames, settings, *this );
8086 for (unsigned int i = 0 ; i < filenames.size (); ++i)
8187 executor.addFileContent (filenames[i], code);
@@ -147,6 +153,22 @@ class TestSuppressions : public TestFixture
147153 " uninitvar:test.cpp" );
148154 ASSERT_EQUALS (" [test.cpp]: (information) Unmatched suppression: uninitvar\n " , errout.str ());
149155
156+ // suppress all for this file only
157+ (this ->*check)(" void f() {\n "
158+ " int a;\n "
159+ " a++;\n "
160+ " }\n " ,
161+ " *:test.cpp" );
162+ ASSERT_EQUALS (" " , errout.str ());
163+
164+ // suppress all for this file only, without error present
165+ (this ->*check)(" void f() {\n "
166+ " int a;\n "
167+ " b++;\n "
168+ " }\n " ,
169+ " *:test.cpp" );
170+ ASSERT_EQUALS (" [test.cpp]: (information) Unmatched suppression: *\n " , errout.str ());
171+
150172 // suppress uninitvar for this file and line
151173 (this ->*check)(" void f() {\n "
152174 " int a;\n "
0 commit comments