Adds file and line information to the "message", which is used as the summary
of a failure.
This commit is contained in:
@@ -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.
|
||||
|
||||
15
src/gtest.cc
15
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";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user