File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ class TestSuppressions : public TestFixture {
119119 TEST_CASE (addSuppressionLineMultiple);
120120
121121 TEST_CASE (suppressionsParseXmlFile);
122+ TEST_CASE (xmlMacroSuppressions);
122123
123124 TEST_CASE (toString);
124125
@@ -1804,6 +1805,44 @@ class TestSuppressions : public TestFixture {
18041805 ASSERT_EQUALS_LOC (expected, errout_str (), thisfile, thisline);
18051806 }
18061807
1808+ void xmlMacroSuppressions ()
1809+ {
1810+ testXmlSuppressions (
1811+ " <suppressions>\n "
1812+ " <suppress>\n "
1813+ " <id>uninitvar</id>\n "
1814+ " <fileName>file.c</fileName>\n "
1815+ " <macroName>VAR</macroName>\n "
1816+ " </suppress>\n "
1817+ " </suppressions>" ,
1818+
1819+ " #define VAR x\n "
1820+ " int f(void) {\n "
1821+ " int VAR;\n "
1822+ " return VAR;\n "
1823+ " }\n " ,
1824+
1825+ " "
1826+ );
1827+ testXmlSuppressions (
1828+ " <suppressions>\n "
1829+ " <suppress>\n "
1830+ " <id>uninitvar</id>\n "
1831+ " <fileName>file.c</fileName>\n "
1832+ " <macroName>WRONG</macroName>\n "
1833+ " </suppress>\n "
1834+ " </suppressions>" ,
1835+
1836+ " #define VAR x\n "
1837+ " int f(void) {\n "
1838+ " int VAR;\n "
1839+ " return VAR;\n "
1840+ " }\n " ,
1841+
1842+ " [test.c:4:12]: (error) Uninitialized variable: x [uninitvar]\n "
1843+ );
1844+ }
1845+
18071846 void addSuppressionDuplicate () const {
18081847 SuppressionList supprs;
18091848
You can’t perform that action at this time.
0 commit comments