From 23584e4ec5fd47e20f6a11395b5e672e203fc1ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bergstr=C3=B6m?= Date: Tue, 25 Oct 2016 12:23:48 -0300 Subject: [PATCH] gtest: output tap comments as yamlish This makes yaml-ish parsers happy. Note: gtest still seems to output the expected/result slightly different making the full traceback less informational. PR-URL: https://github.com/nodejs/node/pull/9262 Reviewed-By: Gibson Fahnestock Reviewed-By: Ben Noordhuis Reviewed-By: Myles Borins --- deps/gtest/src/gtest.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/deps/gtest/src/gtest.cc b/deps/gtest/src/gtest.cc index 213740ca0c7943..87b67a2230fe55 100644 --- a/deps/gtest/src/gtest.cc +++ b/deps/gtest/src/gtest.cc @@ -3596,13 +3596,15 @@ void TapUnitTestResultPrinter::OutputTapTestInfo(int* count, *stream << " ---\n"; *stream << " duration_ms: " << FormatTimeInMillisAsSeconds(result.elapsed_time()) << "\n"; - *stream << " ...\n"; - for (int i = 0; i < result.total_part_count(); ++i) { - const TestPartResult& part = result.GetTestPartResult(i); - OutputTapComment(stream, part.message()); + if (result.total_part_count() > 0) { + *stream << " stack: |-\n"; + for (int i = 0; i < result.total_part_count(); ++i) { + const TestPartResult& part = result.GetTestPartResult(i); + OutputTapComment(stream, part.message()); + } } - + *stream << " ...\n"; *count += 1; } @@ -3610,11 +3612,11 @@ void TapUnitTestResultPrinter::OutputTapComment(::std::ostream* stream, const char* comment) { const char* start = comment; while (const char* end = strchr(start, '\n')) { - *stream << "# " << std::string(start, end) << "\n"; + *stream << " " << std::string(start, end) << "\n"; start = end + 1; } if (*start) - *stream << "# " << start << "\n"; + *stream << " " << start << "\n"; } // Formats the given time in milliseconds as seconds.