From 28e1da21d8d677bc98f12ccc7fc159ff19e8e817 Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Fri, 28 Jan 2022 07:26:29 -0800 Subject: Finish some missed pieces of the TestCase to TestSuite Migration PiperOrigin-RevId: 424864779 Change-Id: Iac5cafa3568f5fe41c85c52d28f7d61845f76868 --- googletest/samples/sample9_unittest.cc | 8 ++++---- googletest/src/gtest-internal-inl.h | 10 +++++----- googletest/test/gtest_unittest.cc | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/googletest/samples/sample9_unittest.cc b/googletest/samples/sample9_unittest.cc index e502d08..0245b53 100644 --- a/googletest/samples/sample9_unittest.cc +++ b/googletest/samples/sample9_unittest.cc @@ -29,7 +29,7 @@ // This sample shows how to use Google Test listener API to implement // an alternative console output and how to use the UnitTest reflection API -// to enumerate test cases and tests and to inspect their results. +// to enumerate test suites and tests and to inspect their results. #include @@ -38,7 +38,7 @@ using ::testing::EmptyTestEventListener; using ::testing::InitGoogleTest; using ::testing::Test; -using ::testing::TestCase; +using ::testing::TestSuite; using ::testing::TestEventListeners; using ::testing::TestInfo; using ::testing::TestPartResult; @@ -61,7 +61,7 @@ class TersePrinter : public EmptyTestEventListener { void OnTestStart(const TestInfo& test_info) override { fprintf(stdout, "*** Test %s.%s starting.\n", - test_info.test_case_name(), + test_info.test_suite_name(), test_info.name()); fflush(stdout); } @@ -81,7 +81,7 @@ class TersePrinter : public EmptyTestEventListener { void OnTestEnd(const TestInfo& test_info) override { fprintf(stdout, "*** Test %s.%s ending.\n", - test_info.test_case_name(), + test_info.test_suite_name(), test_info.name()); fflush(stdout); } diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h index 0b25d2f..62b5b10 100644 --- a/googletest/src/gtest-internal-inl.h +++ b/googletest/src/gtest-internal-inl.h @@ -1148,15 +1148,15 @@ class StreamingListener : public EmptyTestEventListener { // Note that "event=TestCaseStart" is a wire format and has to remain // "case" for compatibility - void OnTestCaseStart(const TestCase& test_case) override { - SendLn(std::string("event=TestCaseStart&name=") + test_case.name()); + void OnTestSuiteStart(const TestSuite& test_suite) override { + SendLn(std::string("event=TestCaseStart&name=") + test_suite.name()); } // Note that "event=TestCaseEnd" is a wire format and has to remain // "case" for compatibility - void OnTestCaseEnd(const TestCase& test_case) override { - SendLn("event=TestCaseEnd&passed=" + FormatBool(test_case.Passed()) + - "&elapsed_time=" + StreamableToString(test_case.elapsed_time()) + + void OnTestSuiteEnd(const TestSuite& test_suite) override { + SendLn("event=TestCaseEnd&passed=" + FormatBool(test_suite.Passed()) + + "&elapsed_time=" + StreamableToString(test_suite.elapsed_time()) + "ms"); } diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index f70ca69..0f10df5 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -111,15 +111,15 @@ TEST_F(StreamingListenerTest, OnTestIterationEnd) { EXPECT_EQ("event=TestIterationEnd&passed=1&elapsed_time=0ms\n", *output()); } -TEST_F(StreamingListenerTest, OnTestCaseStart) { +TEST_F(StreamingListenerTest, OnTestSuiteStart) { *output() = ""; - streamer_.OnTestCaseStart(TestCase("FooTest", "Bar", nullptr, nullptr)); + streamer_.OnTestSuiteStart(TestSuite("FooTest", "Bar", nullptr, nullptr)); EXPECT_EQ("event=TestCaseStart&name=FooTest\n", *output()); } -TEST_F(StreamingListenerTest, OnTestCaseEnd) { +TEST_F(StreamingListenerTest, OnTestSuiteEnd) { *output() = ""; - streamer_.OnTestCaseEnd(TestCase("FooTest", "Bar", nullptr, nullptr)); + streamer_.OnTestSuiteEnd(TestSuite("FooTest", "Bar", nullptr, nullptr)); EXPECT_EQ("event=TestCaseEnd&passed=1&elapsed_time=0ms\n", *output()); } -- cgit v0.12