@@ -396,7 +396,6 @@ class TestSuppressions : public TestFixture {
396396 }
397397#endif // HAS_THREADING_MODEL_FORK
398398
399- // TODO: check all results
400399 void runChecks (unsigned int (TestSuppressions::*check)(const char [], const std::string &)) {
401400 // check to make sure the appropriate errors are present
402401 ASSERT_EQUALS (1 , (this ->*check)(" void f() {\n "
@@ -720,6 +719,38 @@ class TestSuppressions : public TestFixture {
720719 " [test.cpp:6:0]: (error) unknown suppression type 'cppcheck-suppress-end-unknown' [invalidSuppression]\n "
721720 " [test.cpp:4:0]: (error) Suppress Begin: No matching end [invalidSuppression]\n " , errout_str ());
722721
722+ ASSERT_EQUALS (1 , (this ->*check)(" // cppcheck-suppress-file\n "
723+ " // cppcheck-suppress\n "
724+ " // cppcheck-suppress \n "
725+ " // cppcheck-suppress\t\n "
726+ " // cppcheck-suppress []\n " // TODO
727+ " // cppcheck-suppress-begin\n "
728+ " // cppcheck-suppress-begin id0\n "
729+ " void f() {}\n "
730+ " // cppcheck-suppress-end\n " ,
731+ " " ));
732+ ASSERT_EQUALS (" [test.cpp:1:0]: (error) suppression without error ID [invalidSuppression]\n "
733+ " [test.cpp:2:0]: (error) suppression without error ID [invalidSuppression]\n "
734+ " [test.cpp:3:0]: (error) suppression without error ID [invalidSuppression]\n "
735+ " [test.cpp:4:0]: (error) suppression without error ID [invalidSuppression]\n "
736+ " [test.cpp:6:0]: (error) suppression without error ID [invalidSuppression]\n "
737+ " [test.cpp:9:0]: (error) suppression without error ID [invalidSuppression]\n "
738+ " [test.cpp:7:0]: (error) Suppress Begin: No matching end [invalidSuppression]\n " , errout_str ());
739+
740+ ASSERT_EQUALS (1 , (this ->*check)(" // cppcheck-suppress:\n "
741+ " // cppcheck-suppress-unknown\n "
742+ " // cppcheck-suppress-begin-unknown\n "
743+ " // cppcheck-suppress-begin\n "
744+ " void f() {}\n "
745+ " // cppcheck-suppress-end-unknown\n " ,
746+ " " ));
747+ // TODO: actually these are all invalid types
748+ ASSERT_EQUALS (" [test.cpp:1:0]: (error) suppression without error ID [invalidSuppression]\n "
749+ " [test.cpp:2:0]: (error) suppression without error ID [invalidSuppression]\n "
750+ " [test.cpp:3:0]: (error) suppression without error ID [invalidSuppression]\n "
751+ " [test.cpp:4:0]: (error) suppression without error ID [invalidSuppression]\n "
752+ " [test.cpp:6:0]: (error) suppression without error ID [invalidSuppression]\n " , errout_str ());
753+
723754 ASSERT_EQUALS (1 , (this ->*check)(" void f() {\n "
724755 " int a;\n "
725756 " // cppcheck-suppress-begin uninitvar\n "
@@ -915,13 +946,15 @@ class TestSuppressions : public TestFixture {
915946 " uninitvar" ));
916947 ASSERT_EQUALS (" " , errout_str ());
917948
949+ // TODO: check result
918950 // cppcheck-suppress-macro
919951 (this ->*check)(" // cppcheck-suppress-macro zerodiv\n "
920952 " #define DIV(A,B) A/B\n "
921953 " a = DIV(10,0);\n " ,
922954 " " );
923955 ASSERT_EQUALS (" " , errout_str ());
924956
957+ // TODO: check result
925958 (this ->*check)(" // cppcheck-suppress-macro abc\n "
926959 " #define DIV(A,B) A/B\n "
927960 " a = DIV(10,1);\n " ,
0 commit comments