diff options
author | jgm@google.com <jgm@google.com@861a406c-534a-0410-8894-cb66d6ee9925> | 2012-01-17 15:11:32 +0000 |
---|---|---|
committer | jgm@google.com <jgm@google.com@861a406c-534a-0410-8894-cb66d6ee9925> | 2012-01-17 15:11:32 +0000 |
commit | 4dcb99d7acb0a551b7122f68a4d15d993f748c9d (patch) | |
tree | 1d5652c238bd324c2c3181c451f74b1fed8405da /src/gtest.cc | |
parent | 580d3fc0ae4e4332a89f05039fef9f04ccf60d44 (diff) | |
download | gtest-4dcb99d7acb0a551b7122f68a4d15d993f748c9d.tar.gz gtest-4dcb99d7acb0a551b7122f68a4d15d993f748c9d.tar.bz2 gtest-4dcb99d7acb0a551b7122f68a4d15d993f748c9d.tar.xz |
Adds file and line information to the "message", which is used as the summary
of a failure.
git-svn-id: http://googletest.googlecode.com/svn/trunk@609 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'src/gtest.cc')
-rw-r--r-- | src/gtest.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/gtest.cc b/src/gtest.cc index f2e84af..56af646 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"; } } |