MCPcopy Create free account
hub / github.com/ComodoSecurity/openedr / printFailure

Method printFailure

edrav2/eprj/jsoncpp/src/test_lib_json/jsontest.cpp:143–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141bool TestResult::failed() const { return !failures_.empty(); }
142
143void TestResult::printFailure(bool printTestName) const {
144 if (failures_.empty()) {
145 return;
146 }
147
148 if (printTestName) {
149 printf("* Detail of %s test failure:\n", name_.c_str());
150 }
151
152 // Print in reverse to display the callstack in the right order
153 for (const auto & failure : failures_ ) {
154 JSONCPP_STRING indent(failure.nestingLevel_ * 2, ' ');
155 if (failure.file_) {
156 printf("%s%s(%u): ", indent.c_str(), failure.file_, failure.line_);
157 }
158 if (!failure.expr_.empty()) {
159 printf("%s\n", failure.expr_.c_str());
160 } else if (failure.file_) {
161 printf("\n");
162 }
163 if (!failure.message_.empty()) {
164 JSONCPP_STRING reindented = indentText(failure.message_, indent + " ");
165 printf("%s\n", reindented.c_str());
166 }
167 }
168}
169
170JSONCPP_STRING TestResult::indentText(const JSONCPP_STRING& text,
171 const JSONCPP_STRING& indent) {

Callers 1

runAllTestMethod · 0.80

Calls 3

printfClass · 0.85
emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected