MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / symbol

Method symbol

test/testsuppressions.cpp:1513–1536  ·  view source on GitHub ↗

TODO: this tests an internal function - should it be private?

Source from the content-addressed store, hash-verified

1511
1512 // TODO: this tests an internal function - should it be private?
1513 void symbol() const {
1514 SuppressionList::Suppression s;
1515 s.fileName = "test.cpp";
1516 s.errorId = "foo";
1517 s.symbolName = "array*";
1518
1519 SuppressionList::ErrorMessage errorMsg;
1520 errorMsg.errorId = "foo";
1521 errorMsg.symbolNames = "";
1522 ASSERT_EQUALS_ENUM(SuppressionList::Suppression::Result::None, s.isSuppressed(errorMsg));
1523 errorMsg.setFileName("test.cpp");
1524 errorMsg.lineNumber = 123;
1525 ASSERT_EQUALS_ENUM(SuppressionList::Suppression::Result::Checked, s.isSuppressed(errorMsg));
1526 errorMsg.symbolNames = "x\n";
1527 ASSERT_EQUALS_ENUM(SuppressionList::Suppression::Result::Checked, s.isSuppressed(errorMsg));
1528 errorMsg.symbolNames = "array1\n";
1529 ASSERT_EQUALS_ENUM(SuppressionList::Suppression::Result::Matched, s.isSuppressed(errorMsg));
1530 errorMsg.symbolNames = "x\n"
1531 "array2\n";
1532 ASSERT_EQUALS_ENUM(SuppressionList::Suppression::Result::Matched, s.isSuppressed(errorMsg));
1533 errorMsg.symbolNames = "array3\n"
1534 "x\n";
1535 ASSERT_EQUALS_ENUM(SuppressionList::Suppression::Result::Matched, s.isSuppressed(errorMsg));
1536 }
1537
1538 void unusedFunctionInternal(unsigned int (TestSuppressions::*check)(const char[], const std::string &)) {
1539 ASSERT_EQUALS(0, (this->*check)("void f() {}", "unusedFunction"));

Callers

nothing calls this directly

Calls 2

isSuppressedMethod · 0.45
setFileNameMethod · 0.45

Tested by

no test coverage detected