diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 99b22ed3..698ab10d 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -2571,7 +2571,14 @@ static std::string FormatCxxExceptionMessage(const char* description, const char* location) { Message message; if (description != nullptr) { - message << "C++ exception with description \"" << description << "\""; + std::string desc(description); + if (desc.find('\n') == std::string::npos) { + message << "C++ exception with description \"" << desc << "\""; + } else { + message << "C++ exception with description\n> "; + std::replace(desc.begin(), desc.end(), '\n', '\n> '); + message << desc; + } } else { message << "Unknown C++ exception"; } @@ -2580,6 +2587,7 @@ static std::string FormatCxxExceptionMessage(const char* description, return message.GetString(); } + static std::string PrintTestPartResultToString( const TestPartResult& test_part_result);