Skip to content

Commit 28e1da2

Browse files
derekmaurocopybara-github
authored andcommitted
Finish some missed pieces of the TestCase to TestSuite Migration
PiperOrigin-RevId: 424864779 Change-Id: Iac5cafa3568f5fe41c85c52d28f7d61845f76868
1 parent 0b7798b commit 28e1da2

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

googletest/samples/sample9_unittest.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
// This sample shows how to use Google Test listener API to implement
3131
// an alternative console output and how to use the UnitTest reflection API
32-
// to enumerate test cases and tests and to inspect their results.
32+
// to enumerate test suites and tests and to inspect their results.
3333

3434
#include <stdio.h>
3535

@@ -38,7 +38,7 @@
3838
using ::testing::EmptyTestEventListener;
3939
using ::testing::InitGoogleTest;
4040
using ::testing::Test;
41-
using ::testing::TestCase;
41+
using ::testing::TestSuite;
4242
using ::testing::TestEventListeners;
4343
using ::testing::TestInfo;
4444
using ::testing::TestPartResult;
@@ -61,7 +61,7 @@ class TersePrinter : public EmptyTestEventListener {
6161
void OnTestStart(const TestInfo& test_info) override {
6262
fprintf(stdout,
6363
"*** Test %s.%s starting.\n",
64-
test_info.test_case_name(),
64+
test_info.test_suite_name(),
6565
test_info.name());
6666
fflush(stdout);
6767
}
@@ -81,7 +81,7 @@ class TersePrinter : public EmptyTestEventListener {
8181
void OnTestEnd(const TestInfo& test_info) override {
8282
fprintf(stdout,
8383
"*** Test %s.%s ending.\n",
84-
test_info.test_case_name(),
84+
test_info.test_suite_name(),
8585
test_info.name());
8686
fflush(stdout);
8787
}

googletest/src/gtest-internal-inl.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,15 +1148,15 @@ class StreamingListener : public EmptyTestEventListener {
11481148

11491149
// Note that "event=TestCaseStart" is a wire format and has to remain
11501150
// "case" for compatibility
1151-
void OnTestCaseStart(const TestCase& test_case) override {
1152-
SendLn(std::string("event=TestCaseStart&name=") + test_case.name());
1151+
void OnTestSuiteStart(const TestSuite& test_suite) override {
1152+
SendLn(std::string("event=TestCaseStart&name=") + test_suite.name());
11531153
}
11541154

11551155
// Note that "event=TestCaseEnd" is a wire format and has to remain
11561156
// "case" for compatibility
1157-
void OnTestCaseEnd(const TestCase& test_case) override {
1158-
SendLn("event=TestCaseEnd&passed=" + FormatBool(test_case.Passed()) +
1159-
"&elapsed_time=" + StreamableToString(test_case.elapsed_time()) +
1157+
void OnTestSuiteEnd(const TestSuite& test_suite) override {
1158+
SendLn("event=TestCaseEnd&passed=" + FormatBool(test_suite.Passed()) +
1159+
"&elapsed_time=" + StreamableToString(test_suite.elapsed_time()) +
11601160
"ms");
11611161
}
11621162

googletest/test/gtest_unittest.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ TEST_F(StreamingListenerTest, OnTestIterationEnd) {
111111
EXPECT_EQ("event=TestIterationEnd&passed=1&elapsed_time=0ms\n", *output());
112112
}
113113

114-
TEST_F(StreamingListenerTest, OnTestCaseStart) {
114+
TEST_F(StreamingListenerTest, OnTestSuiteStart) {
115115
*output() = "";
116-
streamer_.OnTestCaseStart(TestCase("FooTest", "Bar", nullptr, nullptr));
116+
streamer_.OnTestSuiteStart(TestSuite("FooTest", "Bar", nullptr, nullptr));
117117
EXPECT_EQ("event=TestCaseStart&name=FooTest\n", *output());
118118
}
119119

120-
TEST_F(StreamingListenerTest, OnTestCaseEnd) {
120+
TEST_F(StreamingListenerTest, OnTestSuiteEnd) {
121121
*output() = "";
122-
streamer_.OnTestCaseEnd(TestCase("FooTest", "Bar", nullptr, nullptr));
122+
streamer_.OnTestSuiteEnd(TestSuite("FooTest", "Bar", nullptr, nullptr));
123123
EXPECT_EQ("event=TestCaseEnd&passed=1&elapsed_time=0ms\n", *output());
124124
}
125125

0 commit comments

Comments
 (0)