40 using internal::GetUnitTestImpl;
44 std::string TestPartResult::ExtractSummary(
const char* message) {
46 return stack_trace ==
nullptr ? message : std::string(message, stack_trace);
50 std::ostream&
operator<<(std::ostream& os,
const TestPartResult& result) {
54 << (result.type() == TestPartResult::kSuccess
56 : result.type() == TestPartResult::kSkip
58 : result.type() == TestPartResult::kFatalFailure
60 :
"Non-fatal failure")
62 << result.message() << std::endl;
66 void TestPartResultArray::Append(
const TestPartResult& result) {
67 array_.push_back(result);
71 const TestPartResult& TestPartResultArray::GetTestPartResult(
int index)
const {
72 if (index < 0 || index >= size()) {
73 printf(
"\nInvalid index (%d) into TestPartResultArray.\n", index);
77 return array_[
static_cast<size_t>(index)];
81 int TestPartResultArray::size()
const {
82 return static_cast<int>(array_.size());
87 HasNewFatalFailureHelper::HasNewFatalFailureHelper()
88 : has_new_fatal_failure_(
false),
89 original_reporter_(GetUnitTestImpl()->
90 GetTestPartResultReporterForCurrentThread()) {
91 GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(
this);
94 HasNewFatalFailureHelper::~HasNewFatalFailureHelper() {
95 GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(
99 void HasNewFatalFailureHelper::ReportTestPartResult(
100 const TestPartResult& result) {
101 if (result.fatally_failed())
102 has_new_fatal_failure_ =
true;
103 original_reporter_->ReportTestPartResult(result);
GTEST_API_::std::string FormatFileLocation(const char *file, int line)
std::ostream & operator<<(std::ostream &os, const Message &sb)
GTEST_API_ const char kStackTraceMarker[]