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

Method getErrorMessages

test/testcppcheck.cpp:89–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87 }
88
89 void getErrorMessages() const {
90 ErrorLogger2 errorLogger;
91 CppCheck::getErrorMessages(errorLogger);
92 ASSERT(!errorLogger.ids.empty());
93
94 // Check if there are duplicate error ids in errorLogger.id
95 std::string duplicate;
96 for (auto it = errorLogger.ids.cbegin();
97 it != errorLogger.ids.cend();
98 ++it) {
99 if (std::find(errorLogger.ids.cbegin(), it, *it) != it) {
100 duplicate = "Duplicate ID: " + *it;
101 break;
102 }
103 }
104 ASSERT_EQUALS("", duplicate);
105
106 // Check for error ids from this class.
107 bool foundPurgedConfiguration = false;
108 bool foundTooManyConfigs = false;
109 bool foundMissingInclude = false; // #11984
110 bool foundMissingIncludeSystem = false; // #11984
111 for (const std::string & it : errorLogger.ids) {
112 if (it == "purgedConfiguration")
113 foundPurgedConfiguration = true;
114 else if (it == "toomanyconfigs")
115 foundTooManyConfigs = true;
116 else if (it == "missingInclude")
117 foundMissingInclude = true;
118 else if (it == "missingIncludeSystem")
119 foundMissingIncludeSystem = true;
120 }
121 ASSERT(foundPurgedConfiguration);
122 ASSERT(foundTooManyConfigs);
123 ASSERT(foundMissingInclude);
124 ASSERT(foundMissingIncludeSystem);
125 }
126
127 static std::string exename_(const std::string& exe)
128 {

Callers

nothing calls this directly

Calls 2

getErrorMessagesFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected