From 1d505b8e40db0204fd0515673fa97137680cb8ac Mon Sep 17 00:00:00 2001 From: Denis Hananein Date: Tue, 11 Oct 2022 12:11:46 +0200 Subject: [PATCH] Fix JSON output format #3884 --- googletest/src/gtest.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 638d53bb45..385945284e 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -4829,6 +4829,9 @@ void JsonUnitTestResultPrinter::PrintJsonUnitTest(std::ostream* stream, // If there was a test failure outside of one of the test suites (like in a // test environment) include that in the output. if (unit_test.ad_hoc_test_result().Failed()) { + if (comma) { + *stream << ",\n"; + } OutputJsonTestSuiteForTestResult(stream, unit_test.ad_hoc_test_result()); }