diff options
author | Szymon Sobik <sobik.szymon@gmail.com> | 2022-03-08 00:12:35 (GMT) |
---|---|---|
committer | Szymon Sobik <sobik.szymon@gmail.com> | 2022-03-08 00:12:35 (GMT) |
commit | f7621f01918415d5d51a5c967cfe0e06a1544bb0 (patch) | |
tree | 5aae595f0f37681c47eb24176563f652abed3462 /googletest | |
parent | c9461a9b55ba954df0489bab6420eb297bed846b (diff) | |
download | googletest-f7621f01918415d5d51a5c967cfe0e06a1544bb0.zip googletest-f7621f01918415d5d51a5c967cfe0e06a1544bb0.tar.gz googletest-f7621f01918415d5d51a5c967cfe0e06a1544bb0.tar.bz2 |
Output source file path and line number in xml and json files.
It outputs the location of testcase only.
Standalone EXPECT will have no location.
Diffstat (limited to 'googletest')
-rw-r--r-- | googletest/src/gtest.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 396fdfe..a877bc7 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -4286,10 +4286,11 @@ void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream, OutputXmlAttribute(stream, kTestsuite, "type_param", test_info.type_param()); } + + OutputXmlAttribute(stream, kTestsuite, "file", test_info.file()); + OutputXmlAttribute(stream, kTestsuite, "line", + StreamableToString(test_info.line())); if (GTEST_FLAG_GET(list_tests)) { - OutputXmlAttribute(stream, kTestsuite, "file", test_info.file()); - OutputXmlAttribute(stream, kTestsuite, "line", - StreamableToString(test_info.line())); *stream << " />\n"; return; } @@ -4744,11 +4745,14 @@ void JsonUnitTestResultPrinter::OutputJsonTestInfo(::std::ostream* stream, OutputJsonKey(stream, kTestsuite, "type_param", test_info.type_param(), kIndent); } + + OutputJsonKey(stream, kTestsuite, "file", test_info.file(), kIndent); + OutputJsonKey(stream, kTestsuite, "line", test_info.line(), kIndent, false); if (GTEST_FLAG_GET(list_tests)) { - OutputJsonKey(stream, kTestsuite, "file", test_info.file(), kIndent); - OutputJsonKey(stream, kTestsuite, "line", test_info.line(), kIndent, false); *stream << "\n" << Indent(8) << "}"; return; + } else { + *stream << ",\n"; } OutputJsonKey(stream, kTestsuite, "status", |