diff options
author | jgm <jgm@google.com> | 2012-01-17 15:11:32 +0000 |
---|---|---|
committer | jgm <jgm@google.com> | 2012-01-17 15:11:32 +0000 |
commit | 4d6f296e8e5d3f839ef4868390bbec27cb12e068 (patch) | |
tree | 1d5652c238bd324c2c3181c451f74b1fed8405da /src | |
parent | 69a071bc0d1c87b9b8271e8d7545ade7086be6bb (diff) | |
download | googletest-4d6f296e8e5d3f839ef4868390bbec27cb12e068.tar.gz googletest-4d6f296e8e5d3f839ef4868390bbec27cb12e068.tar.bz2 googletest-4d6f296e8e5d3f839ef4868390bbec27cb12e068.zip |
Adds file and line information to the "message", which is used as the summary
of a failure.
Diffstat (limited to 'src')
-rw-r--r-- | src/gtest-internal-inl.h | 2 | ||||
-rw-r--r-- | src/gtest.cc | 15 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/gtest-internal-inl.h b/src/gtest-internal-inl.h index 4e9805d1..350ade07 100644 --- a/src/gtest-internal-inl.h +++ b/src/gtest-internal-inl.h @@ -620,7 +620,7 @@ class GTEST_API_ UnitTestImpl { // For example, if Foo() calls Bar(), which in turn calls // CurrentOsStackTraceExceptTop(1), Foo() will be included in the // trace but Bar() and CurrentOsStackTraceExceptTop() won't. - String CurrentOsStackTraceExceptTop(int skip_count); + String CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_; // Finds and returns a TestCase with the given name. If one doesn't // exist, creates one and returns it. diff --git a/src/gtest.cc b/src/gtest.cc index f2e84af7..56af6469 100644 --- a/src/gtest.cc +++ b/src/gtest.cc @@ -3271,16 +3271,17 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream, for (int i = 0; i < result.total_part_count(); ++i) { const TestPartResult& part = result.GetTestPartResult(i); if (part.failed()) { - if (++failures == 1) + if (++failures == 1) { *stream << ">\n"; - *stream << " <failure message=\"" - << EscapeXmlAttribute(part.summary()).c_str() - << "\" type=\"\">"; + } const string location = internal::FormatCompilerIndependentFileLocation( part.file_name(), part.line_number()); - const string message = location + "\n" + part.message(); - OutputXmlCDataSection(stream, - RemoveInvalidXmlCharacters(message).c_str()); + const string summary = location + "\n" + part.summary(); + *stream << " <failure message=\"" + << EscapeXmlAttribute(summary.c_str()) + << "\" type=\"\">"; + const string detail = location + "\n" + part.message(); + OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str()); *stream << "</failure>\n"; } } |