MCPcopy Create free account
hub / github.com/Kitware/VTK / HasErrorMessage

Function HasErrorMessage

Testing/Core/vtkTestErrorObserver.h:94–114  ·  view source on GitHub ↗

* Check to see if an error message exists. * Given an observer, a message and a status with an initial value, * Returns false if an error does not exist, or if msg is not contained * in the error message. * Returns true if the error exists and msg is contained in the error * message. * If the test fails, it reports the failing message, prepended with "ERROR:". * ctest will det

Source from the content-addressed store, hash-verified

92 * see: CheckErrorMessage.
93 */
94 bool HasErrorMessage(const std::string& expectedMsg)
95 {
96 if (!this->GetError())
97 {
98 std::cout << "ERROR: Failed to catch any error. Expected the error message to contain \""
99 << expectedMsg << '\"' << std::endl;
100 return false;
101 }
102 else
103 {
104 std::string gotMsg(this->GetErrorMessage());
105 if (gotMsg.find(expectedMsg) == std::string::npos)
106 {
107 std::cout << "ERROR: Error message does not contain \"" << expectedMsg << "\" got \n\""
108 << gotMsg << '\"' << std::endl;
109 return false;
110 }
111 }
112
113 return true;
114 }
115
116 /**
117 * Check to see if a warning message exists.

Callers

nothing calls this directly

Calls 2

GetErrorMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected