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

Method purgedConfiguration

test/testcppcheck.cpp:598–623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

596 }
597
598 void purgedConfiguration() const
599 {
600 ScopedFile test_file("test.cpp",
601 "#ifdef X\n"
602 "#endif\n"
603 "int main() {}\n");
604
605 // this is the "simple" format
606 const auto s = dinit(Settings,
607 $.templateFormat = templateFormat, // TODO: remove when we only longer rely on toString() in unique message handling
608 $.severity.enable (Severity::information);
609 $.debugwarnings = true);
610 Suppressions supprs;
611 ErrorLogger2 errorLogger;
612 CppCheck cppcheck(s, supprs, errorLogger, nullptr, false, {});
613 ASSERT_EQUALS(1, cppcheck.check(FileWithDetails(test_file.path(), Path::identify(test_file.path(), false), 0)));
614 // TODO: how to properly disable these warnings?
615 errorLogger.errmsgs.erase(std::remove_if(errorLogger.errmsgs.begin(), errorLogger.errmsgs.end(), [](const ErrorMessage& msg) {
616 return msg.id == "logChecker";
617 }), errorLogger.errmsgs.end());
618 // the internal errorlist is cleared after each check() call
619 ASSERT_EQUALS(1, errorLogger.errmsgs.size());
620 auto it = errorLogger.errmsgs.cbegin();
621 ASSERT_EQUALS("test.cpp:0:0: information: The configuration 'X=X' was not checked because its code equals another one. [purgedConfiguration]",
622 it->toString(false, templateFormat, ""));
623 }
624
625 // TODO: test suppressions
626 // TODO: test all with FS

Callers

nothing calls this directly

Calls 8

enableMethod · 0.80
FileWithDetailsClass · 0.50
checkMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected