// Called after a failed assertion or a SUCCESS(). // Print the test header for the first error or // a continuation line for additional errors. // Then print the failed test summary. void TersePrinter::OnTestPartResult(const TestPartResult& test_part_result) { if (test_part_result.failed() ) { if (!test_header_printed_) { // print the message header test_header_printed_ = true; PrintTestHeader(COLOR_RED); // print the file name // the following checks for an error in a mock if (test_part_result.file_name() || test_part_result.line_number() > 0) { printf("%s:(%d)\n", test_part_result.file_name(), test_part_result.line_number()); } } else { ColoredPrintf(COLOR_RED, "%s", "[ ]\n"); } // print the failed test summary PrintFailedTestSummary(string(test_part_result.summary())); fflush(stdout); } }
// Called after a failed assertion or SUCCEED() invocation void AlternatePrinter::OnTestPartResult(const TestPartResult& test_part_result) { fprintf(stdout, "%s in %s:%d\n%s\n\n", test_part_result.failed() ? "*** Failure" : "Success", test_part_result.file_name(), test_part_result.line_number(), test_part_result.summary()); fflush(stdout); }
// Called after failed assertion or SUCCEED() void TestSuite::OnTestPartResult(const TestPartResult& test_part_result) { this->currentTestInfo->status = !test_part_result.failed(); this->currentTestInfo->summary = test_part_result.summary(); }