Skip to content

Commit 36abbbe

Browse files
jbergstroemMyles Borins
authored and
Myles Borins
committed
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: #9262 Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Myles Borins <[email protected]>
1 parent 747013b commit 36abbbe

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

deps/gtest/src/gtest.cc

+9-7
Original file line numberDiff line numberDiff line change
@@ -3596,25 +3596,27 @@ void TapUnitTestResultPrinter::OutputTapTestInfo(int* count,
35963596
*stream << " ---\n";
35973597
*stream << " duration_ms: " <<
35983598
FormatTimeInMillisAsSeconds(result.elapsed_time()) << "\n";
3599-
*stream << " ...\n";
36003599

3601-
for (int i = 0; i < result.total_part_count(); ++i) {
3602-
const TestPartResult& part = result.GetTestPartResult(i);
3603-
OutputTapComment(stream, part.message());
3600+
if (result.total_part_count() > 0) {
3601+
*stream << " stack: |-\n";
3602+
for (int i = 0; i < result.total_part_count(); ++i) {
3603+
const TestPartResult& part = result.GetTestPartResult(i);
3604+
OutputTapComment(stream, part.message());
3605+
}
36043606
}
3605-
3607+
*stream << " ...\n";
36063608
*count += 1;
36073609
}
36083610

36093611
void TapUnitTestResultPrinter::OutputTapComment(::std::ostream* stream,
36103612
const char* comment) {
36113613
const char* start = comment;
36123614
while (const char* end = strchr(start, '\n')) {
3613-
*stream << "# " << std::string(start, end) << "\n";
3615+
*stream << " " << std::string(start, end) << "\n";
36143616
start = end + 1;
36153617
}
36163618
if (*start)
3617-
*stream << "# " << start << "\n";
3619+
*stream << " " << start << "\n";
36183620
}
36193621

36203622
// Formats the given time in milliseconds as seconds.

0 commit comments

Comments
 (0)