@@ -103,6 +103,8 @@ class TestSuppressions : public TestFixture {
103
103
TEST_CASE (suppressionsParseXmlFile);
104
104
105
105
TEST_CASE (toString);
106
+
107
+ TEST_CASE (suppressionFromErrorMessage);
106
108
}
107
109
108
110
void suppressionsBadId1 () const {
@@ -1661,6 +1663,41 @@ class TestSuppressions : public TestFixture {
1661
1663
ASSERT_EQUALS (" unitvar:sym" , s.toString ());
1662
1664
}
1663
1665
}
1666
+
1667
+ void suppressionFromErrorMessage () const {
1668
+ {
1669
+ const ErrorMessage msg ({}, " test1.cpp" , Severity::information, " msg" , " id" , Certainty::inconclusive);
1670
+ const auto msg_s = SuppressionList::ErrorMessage::fromErrorMessage (msg, {" m1" , " m2" });
1671
+ ASSERT_EQUALS (" test1.cpp" , msg_s.getFileName ());
1672
+ ASSERT_EQUALS (SuppressionList::Suppression::NO_LINE, msg_s.lineNumber );
1673
+ ASSERT_EQUALS (" id" , msg_s.errorId );
1674
+ ASSERT_EQUALS_ENUM (Certainty::inconclusive, msg_s.certainty );
1675
+ ASSERT_EQUALS (" " , msg_s.symbolNames );
1676
+ ASSERT_EQUALS (2 , msg_s.macroNames .size ());
1677
+ auto it = msg_s.macroNames .cbegin ();
1678
+ ASSERT_EQUALS (" m1" , *it);
1679
+ ++it;
1680
+ ASSERT_EQUALS (" m2" , *it);
1681
+ }
1682
+ {
1683
+ std::list<ErrorMessage::FileLocation> loc;
1684
+ loc.emplace_back (" test1.cpp" , 1 , 1 );
1685
+ const ErrorMessage msg (std::move (loc), " test1.cpp" , Severity::information, " msg" , " id" , Certainty::normal);
1686
+ const auto msg_s = SuppressionList::ErrorMessage::fromErrorMessage (msg, {});
1687
+ ASSERT_EQUALS (" test1.cpp" , msg_s.getFileName ());
1688
+ ASSERT_EQUALS (1 , msg_s.lineNumber );
1689
+ }
1690
+ {
1691
+ std::list<ErrorMessage::FileLocation> loc;
1692
+ loc.emplace_back (" test1.cpp" , 1 , 1 );
1693
+ loc.emplace_back (" test2.cpp" , 2 , 2 );
1694
+ loc.emplace_back (" test3.cpp" , 3 , 3 );
1695
+ const ErrorMessage msg (std::move (loc), " test1.cpp" , Severity::information, " msg" , " id" , Certainty::normal);
1696
+ const auto msg_s = SuppressionList::ErrorMessage::fromErrorMessage (msg, {});
1697
+ ASSERT_EQUALS (" test3.cpp" , msg_s.getFileName ());
1698
+ ASSERT_EQUALS (3 , msg_s.lineNumber );
1699
+ }
1700
+ }
1664
1701
};
1665
1702
1666
1703
REGISTER_TEST (TestSuppressions)
0 commit comments