Suppressions: Handle comment in file that starts with #
This commit is contained in:
parent
c334d959ce
commit
1cd16cf94f
|
@ -74,6 +74,8 @@ std::string Suppressions::parseFile(std::istream &istr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Skip comments
|
// Skip comments
|
||||||
|
if (line.length() > 1 && line[0] == '#')
|
||||||
|
continue;
|
||||||
if (line.length() >= 2 && line[0] == '/' && line[1] == '/')
|
if (line.length() >= 2 && line[0] == '/' && line[1] == '/')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ private:
|
||||||
TEST_CASE(suppressionsMultiFile);
|
TEST_CASE(suppressionsMultiFile);
|
||||||
TEST_CASE(suppressionsPathSeparator);
|
TEST_CASE(suppressionsPathSeparator);
|
||||||
TEST_CASE(suppressionsLine0);
|
TEST_CASE(suppressionsLine0);
|
||||||
|
TEST_CASE(suppressionsFileComment);
|
||||||
|
|
||||||
TEST_CASE(inlinesuppress);
|
TEST_CASE(inlinesuppress);
|
||||||
TEST_CASE(inlinesuppress_symbolname);
|
TEST_CASE(inlinesuppress_symbolname);
|
||||||
|
@ -411,6 +412,18 @@ private:
|
||||||
ASSERT_EQUALS(true, suppressions.isSuppressed(errorMessage("syntaxError", "test.cpp", 0)));
|
ASSERT_EQUALS(true, suppressions.isSuppressed(errorMessage("syntaxError", "test.cpp", 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void suppressionsFileComment() {
|
||||||
|
std::istringstream file1("# comment\nabc");
|
||||||
|
Suppressions suppressions1;
|
||||||
|
suppressions1.parseFile(file1);
|
||||||
|
ASSERT_EQUALS(true, suppressions1.isSuppressed(errorMessage("abc", "test.cpp", 123)));
|
||||||
|
|
||||||
|
std::istringstream file2("// comment\nabc");
|
||||||
|
Suppressions suppressions2;
|
||||||
|
suppressions2.parseFile(file2);
|
||||||
|
ASSERT_EQUALS(true, suppressions2.isSuppressed(errorMessage("abc", "test.cpp", 123)));
|
||||||
|
}
|
||||||
|
|
||||||
void inlinesuppress() {
|
void inlinesuppress() {
|
||||||
Suppressions::Suppression s;
|
Suppressions::Suppression s;
|
||||||
std::string msg;
|
std::string msg;
|
||||||
|
|
Loading…
Reference in New Issue