Commit 26743363 authored by Abseil Team's avatar Abseil Team Committed by Gennadiy Civil
Browse files

Googletest export

Applied fixes for ClangTidy modernize-use-override and modernize-use-using.

PiperOrigin-RevId: 223800219
parent a42cdf2a
...@@ -364,15 +364,13 @@ class NonFatalFailureInFixtureConstructorTest : public testing::Test { ...@@ -364,15 +364,13 @@ class NonFatalFailureInFixtureConstructorTest : public testing::Test {
ADD_FAILURE() << "Expected failure #1, in the test fixture c'tor."; ADD_FAILURE() << "Expected failure #1, in the test fixture c'tor.";
} }
~NonFatalFailureInFixtureConstructorTest() { ~NonFatalFailureInFixtureConstructorTest() override {
ADD_FAILURE() << "Expected failure #5, in the test fixture d'tor."; ADD_FAILURE() << "Expected failure #5, in the test fixture d'tor.";
} }
virtual void SetUp() { void SetUp() override { ADD_FAILURE() << "Expected failure #2, in SetUp()."; }
ADD_FAILURE() << "Expected failure #2, in SetUp().";
}
virtual void TearDown() { void TearDown() override {
ADD_FAILURE() << "Expected failure #4, in TearDown."; ADD_FAILURE() << "Expected failure #4, in TearDown.";
} }
}; };
...@@ -389,17 +387,17 @@ class FatalFailureInFixtureConstructorTest : public testing::Test { ...@@ -389,17 +387,17 @@ class FatalFailureInFixtureConstructorTest : public testing::Test {
Init(); Init();
} }
~FatalFailureInFixtureConstructorTest() { ~FatalFailureInFixtureConstructorTest() override {
ADD_FAILURE() << "Expected failure #2, in the test fixture d'tor."; ADD_FAILURE() << "Expected failure #2, in the test fixture d'tor.";
} }
virtual void SetUp() { void SetUp() override {
ADD_FAILURE() << "UNEXPECTED failure in SetUp(). " ADD_FAILURE() << "UNEXPECTED failure in SetUp(). "
<< "We should never get here, as the test fixture c'tor " << "We should never get here, as the test fixture c'tor "
<< "had a fatal failure."; << "had a fatal failure.";
} }
virtual void TearDown() { void TearDown() override {
ADD_FAILURE() << "UNEXPECTED failure in TearDown(). " ADD_FAILURE() << "UNEXPECTED failure in TearDown(). "
<< "We should never get here, as the test fixture c'tor " << "We should never get here, as the test fixture c'tor "
<< "had a fatal failure."; << "had a fatal failure.";
...@@ -420,18 +418,15 @@ TEST_F(FatalFailureInFixtureConstructorTest, FailureInConstructor) { ...@@ -420,18 +418,15 @@ TEST_F(FatalFailureInFixtureConstructorTest, FailureInConstructor) {
// Tests non-fatal failures in SetUp(). // Tests non-fatal failures in SetUp().
class NonFatalFailureInSetUpTest : public testing::Test { class NonFatalFailureInSetUpTest : public testing::Test {
protected: protected:
virtual ~NonFatalFailureInSetUpTest() { ~NonFatalFailureInSetUpTest() override { Deinit(); }
Deinit();
}
virtual void SetUp() { void SetUp() override {
printf("(expecting 4 failures)\n"); printf("(expecting 4 failures)\n");
ADD_FAILURE() << "Expected failure #1, in SetUp()."; ADD_FAILURE() << "Expected failure #1, in SetUp().";
} }
virtual void TearDown() { void TearDown() override { FAIL() << "Expected failure #3, in TearDown()."; }
FAIL() << "Expected failure #3, in TearDown().";
}
private: private:
void Deinit() { void Deinit() {
FAIL() << "Expected failure #4, in the test fixture d'tor."; FAIL() << "Expected failure #4, in the test fixture d'tor.";
...@@ -445,18 +440,15 @@ TEST_F(NonFatalFailureInSetUpTest, FailureInSetUp) { ...@@ -445,18 +440,15 @@ TEST_F(NonFatalFailureInSetUpTest, FailureInSetUp) {
// Tests fatal failures in SetUp(). // Tests fatal failures in SetUp().
class FatalFailureInSetUpTest : public testing::Test { class FatalFailureInSetUpTest : public testing::Test {
protected: protected:
virtual ~FatalFailureInSetUpTest() { ~FatalFailureInSetUpTest() override { Deinit(); }
Deinit();
}
virtual void SetUp() { void SetUp() override {
printf("(expecting 3 failures)\n"); printf("(expecting 3 failures)\n");
FAIL() << "Expected failure #1, in SetUp()."; FAIL() << "Expected failure #1, in SetUp().";
} }
virtual void TearDown() { void TearDown() override { FAIL() << "Expected failure #2, in TearDown()."; }
FAIL() << "Expected failure #2, in TearDown().";
}
private: private:
void Deinit() { void Deinit() {
FAIL() << "Expected failure #3, in the test fixture d'tor."; FAIL() << "Expected failure #3, in the test fixture d'tor.";
...@@ -508,7 +500,7 @@ static void ThreadRoutine(SpawnThreadNotifications* notifications) { ...@@ -508,7 +500,7 @@ static void ThreadRoutine(SpawnThreadNotifications* notifications) {
class DeathTestAndMultiThreadsTest : public testing::Test { class DeathTestAndMultiThreadsTest : public testing::Test {
protected: protected:
// Starts a thread and waits for it to begin. // Starts a thread and waits for it to begin.
virtual void SetUp() { void SetUp() override {
thread_.reset(new ThreadWithParam<SpawnThreadNotifications*>( thread_.reset(new ThreadWithParam<SpawnThreadNotifications*>(
&ThreadRoutine, &notifications_, nullptr)); &ThreadRoutine, &notifications_, nullptr));
notifications_.spawn_thread_started.WaitForNotification(); notifications_.spawn_thread_started.WaitForNotification();
...@@ -518,7 +510,7 @@ class DeathTestAndMultiThreadsTest : public testing::Test { ...@@ -518,7 +510,7 @@ class DeathTestAndMultiThreadsTest : public testing::Test {
// a manager thread might still be left running that will interfere // a manager thread might still be left running that will interfere
// with later death tests. This is unfortunate, but this class // with later death tests. This is unfortunate, but this class
// cleans up after itself as best it can. // cleans up after itself as best it can.
virtual void TearDown() { void TearDown() override {
notifications_.spawn_thread_ok_to_terminate.Notify(); notifications_.spawn_thread_ok_to_terminate.Notify();
} }
...@@ -1037,11 +1029,9 @@ TEST_F(ExpectFailureTest, ExpectNonFatalFailureOnAllThreads) { ...@@ -1037,11 +1029,9 @@ TEST_F(ExpectFailureTest, ExpectNonFatalFailureOnAllThreads) {
class FooEnvironment : public testing::Environment { class FooEnvironment : public testing::Environment {
public: public:
virtual void SetUp() { void SetUp() override { printf("%s", "FooEnvironment::SetUp() called.\n"); }
printf("%s", "FooEnvironment::SetUp() called.\n");
}
virtual void TearDown() { void TearDown() override {
printf("%s", "FooEnvironment::TearDown() called.\n"); printf("%s", "FooEnvironment::TearDown() called.\n");
FAIL() << "Expected fatal failure."; FAIL() << "Expected fatal failure.";
} }
...@@ -1049,11 +1039,9 @@ class FooEnvironment : public testing::Environment { ...@@ -1049,11 +1039,9 @@ class FooEnvironment : public testing::Environment {
class BarEnvironment : public testing::Environment { class BarEnvironment : public testing::Environment {
public: public:
virtual void SetUp() { void SetUp() override { printf("%s", "BarEnvironment::SetUp() called.\n"); }
printf("%s", "BarEnvironment::SetUp() called.\n");
}
virtual void TearDown() { void TearDown() override {
printf("%s", "BarEnvironment::TearDown() called.\n"); printf("%s", "BarEnvironment::TearDown() called.\n");
ADD_FAILURE() << "Expected non-fatal failure."; ADD_FAILURE() << "Expected non-fatal failure.";
} }
......
...@@ -562,7 +562,7 @@ class TestGenerationEnvironment : public ::testing::Environment { ...@@ -562,7 +562,7 @@ class TestGenerationEnvironment : public ::testing::Environment {
void TearDownExecuted() { tear_down_count_++; } void TearDownExecuted() { tear_down_count_++; }
void TestBodyExecuted() { test_body_count_++; } void TestBodyExecuted() { test_body_count_++; }
virtual void TearDown() { void TearDown() override {
// If all MultipleTestGenerationTest tests have been de-selected // If all MultipleTestGenerationTest tests have been de-selected
// by the filter flag, the following checks make no sense. // by the filter flag, the following checks make no sense.
bool perform_check = false; bool perform_check = false;
...@@ -619,11 +619,11 @@ class TestGenerationTest : public TestWithParam<int> { ...@@ -619,11 +619,11 @@ class TestGenerationTest : public TestWithParam<int> {
Environment::Instance()->FixtureConstructorExecuted(); Environment::Instance()->FixtureConstructorExecuted();
current_parameter_ = GetParam(); current_parameter_ = GetParam();
} }
virtual void SetUp() { void SetUp() override {
Environment::Instance()->SetUpExecuted(); Environment::Instance()->SetUpExecuted();
EXPECT_EQ(current_parameter_, GetParam()); EXPECT_EQ(current_parameter_, GetParam());
} }
virtual void TearDown() { void TearDown() override {
Environment::Instance()->TearDownExecuted(); Environment::Instance()->TearDownExecuted();
EXPECT_EQ(current_parameter_, GetParam()); EXPECT_EQ(current_parameter_, GetParam());
} }
......
...@@ -76,12 +76,12 @@ TEST(DISABLED_D, DISABLED_B) {} ...@@ -76,12 +76,12 @@ TEST(DISABLED_D, DISABLED_B) {}
// iteration with a "----" marker. // iteration with a "----" marker.
class TestNamePrinter : public EmptyTestEventListener { class TestNamePrinter : public EmptyTestEventListener {
public: public:
virtual void OnTestIterationStart(const UnitTest& /* unit_test */, void OnTestIterationStart(const UnitTest& /* unit_test */,
int /* iteration */) { int /* iteration */) override {
printf("----\n"); printf("----\n");
} }
virtual void OnTestStart(const TestInfo& test_info) { void OnTestStart(const TestInfo& test_info) override {
printf("%s.%s\n", test_info.test_case_name(), test_info.name()); printf("%s.%s\n", test_info.test_case_name(), test_info.name());
} }
}; };
......
...@@ -68,14 +68,14 @@ class CommonTest : public Test { ...@@ -68,14 +68,14 @@ class CommonTest : public Test {
CommonTest() : value_(1) {} CommonTest() : value_(1) {}
virtual ~CommonTest() { EXPECT_EQ(3, value_); } ~CommonTest() override { EXPECT_EQ(3, value_); }
virtual void SetUp() { void SetUp() override {
EXPECT_EQ(1, value_); EXPECT_EQ(1, value_);
value_++; value_++;
} }
virtual void TearDown() { void TearDown() override {
EXPECT_EQ(2, value_); EXPECT_EQ(2, value_);
value_++; value_++;
} }
...@@ -215,7 +215,7 @@ using testing::internal::TypedTestCasePState; ...@@ -215,7 +215,7 @@ using testing::internal::TypedTestCasePState;
class TypedTestCasePStateTest : public Test { class TypedTestCasePStateTest : public Test {
protected: protected:
virtual void SetUp() { void SetUp() override {
state_.AddTestName("foo.cc", 0, "FooTest", "A"); state_.AddTestName("foo.cc", 0, "FooTest", "A");
state_.AddTestName("foo.cc", 0, "FooTest", "B"); state_.AddTestName("foo.cc", 0, "FooTest", "B");
state_.AddTestName("foo.cc", 0, "FooTest", "C"); state_.AddTestName("foo.cc", 0, "FooTest", "C");
......
...@@ -232,7 +232,7 @@ TEST(DISABLED_Test, Dummy2) {} ...@@ -232,7 +232,7 @@ TEST(DISABLED_Test, Dummy2) {}
class FinalSuccessChecker : public Environment { class FinalSuccessChecker : public Environment {
protected: protected:
virtual void TearDown() { void TearDown() override {
UnitTest* unit_test = UnitTest::GetInstance(); UnitTest* unit_test = UnitTest::GetInstance();
EXPECT_EQ(1 + kTypedTestCases, unit_test->successful_test_case_count()); EXPECT_EQ(1 + kTypedTestCases, unit_test->successful_test_case_count());
......
...@@ -53,7 +53,7 @@ class MyEnvironment : public testing::Environment { ...@@ -53,7 +53,7 @@ class MyEnvironment : public testing::Environment {
// Depending on the value of failure_in_set_up_, SetUp() will // Depending on the value of failure_in_set_up_, SetUp() will
// generate a non-fatal failure, generate a fatal failure, or // generate a non-fatal failure, generate a fatal failure, or
// succeed. // succeed.
virtual void SetUp() { void SetUp() override {
set_up_was_run_ = true; set_up_was_run_ = true;
switch (failure_in_set_up_) { switch (failure_in_set_up_) {
...@@ -69,7 +69,7 @@ class MyEnvironment : public testing::Environment { ...@@ -69,7 +69,7 @@ class MyEnvironment : public testing::Environment {
} }
// Generates a non-fatal failure. // Generates a non-fatal failure.
virtual void TearDown() { void TearDown() override {
tear_down_was_run_ = true; tear_down_was_run_ = true;
ADD_FAILURE() << "Expected non-fatal failure in global tear-down."; ADD_FAILURE() << "Expected non-fatal failure in global tear-down.";
} }
......
...@@ -122,13 +122,13 @@ struct PredFormatFunctor1 { ...@@ -122,13 +122,13 @@ struct PredFormatFunctor1 {
class Predicate1Test : public testing::Test { class Predicate1Test : public testing::Test {
protected: protected:
virtual void SetUp() { void SetUp() override {
expected_to_finish_ = true; expected_to_finish_ = true;
finished_ = false; finished_ = false;
n1_ = 0; n1_ = 0;
} }
virtual void TearDown() { void TearDown() override {
// Verifies that each of the predicate's arguments was evaluated // Verifies that each of the predicate's arguments was evaluated
// exactly once. // exactly once.
EXPECT_EQ(1, n1_) << EXPECT_EQ(1, n1_) <<
...@@ -514,13 +514,13 @@ struct PredFormatFunctor2 { ...@@ -514,13 +514,13 @@ struct PredFormatFunctor2 {
class Predicate2Test : public testing::Test { class Predicate2Test : public testing::Test {
protected: protected:
virtual void SetUp() { void SetUp() override {
expected_to_finish_ = true; expected_to_finish_ = true;
finished_ = false; finished_ = false;
n1_ = n2_ = 0; n1_ = n2_ = 0;
} }
virtual void TearDown() { void TearDown() override {
// Verifies that each of the predicate's arguments was evaluated // Verifies that each of the predicate's arguments was evaluated
// exactly once. // exactly once.
EXPECT_EQ(1, n1_) << EXPECT_EQ(1, n1_) <<
...@@ -948,13 +948,13 @@ struct PredFormatFunctor3 { ...@@ -948,13 +948,13 @@ struct PredFormatFunctor3 {
class Predicate3Test : public testing::Test { class Predicate3Test : public testing::Test {
protected: protected:
virtual void SetUp() { void SetUp() override {
expected_to_finish_ = true; expected_to_finish_ = true;
finished_ = false; finished_ = false;
n1_ = n2_ = n3_ = 0; n1_ = n2_ = n3_ = 0;
} }
virtual void TearDown() { void TearDown() override {
// Verifies that each of the predicate's arguments was evaluated // Verifies that each of the predicate's arguments was evaluated
// exactly once. // exactly once.
EXPECT_EQ(1, n1_) << EXPECT_EQ(1, n1_) <<
...@@ -1424,13 +1424,13 @@ struct PredFormatFunctor4 { ...@@ -1424,13 +1424,13 @@ struct PredFormatFunctor4 {
class Predicate4Test : public testing::Test { class Predicate4Test : public testing::Test {
protected: protected:
virtual void SetUp() { void SetUp() override {
expected_to_finish_ = true; expected_to_finish_ = true;
finished_ = false; finished_ = false;
n1_ = n2_ = n3_ = n4_ = 0; n1_ = n2_ = n3_ = n4_ = 0;
} }
virtual void TearDown() { void TearDown() override {
// Verifies that each of the predicate's arguments was evaluated // Verifies that each of the predicate's arguments was evaluated
// exactly once. // exactly once.
EXPECT_EQ(1, n1_) << EXPECT_EQ(1, n1_) <<
...@@ -1942,13 +1942,13 @@ struct PredFormatFunctor5 { ...@@ -1942,13 +1942,13 @@ struct PredFormatFunctor5 {
class Predicate5Test : public testing::Test { class Predicate5Test : public testing::Test {
protected: protected:
virtual void SetUp() { void SetUp() override {
expected_to_finish_ = true; expected_to_finish_ = true;
finished_ = false; finished_ = false;
n1_ = n2_ = n3_ = n4_ = n5_ = 0; n1_ = n2_ = n3_ = n4_ = n5_ = 0;
} }
virtual void TearDown() { void TearDown() override {
// Verifies that each of the predicate's arguments was evaluated // Verifies that each of the predicate's arguments was evaluated
// exactly once. // exactly once.
EXPECT_EQ(1, n1_) << EXPECT_EQ(1, n1_) <<
......
...@@ -74,8 +74,8 @@ int g_environment_tear_down_count = 0; ...@@ -74,8 +74,8 @@ int g_environment_tear_down_count = 0;
class MyEnvironment : public testing::Environment { class MyEnvironment : public testing::Environment {
public: public:
MyEnvironment() {} MyEnvironment() {}
virtual void SetUp() { g_environment_set_up_count++; } void SetUp() override { g_environment_set_up_count++; }
virtual void TearDown() { g_environment_tear_down_count++; } void TearDown() override { g_environment_tear_down_count++; }
}; };
// A test that should fail. // A test that should fail.
......
...@@ -78,7 +78,7 @@ class StreamingListenerTest : public Test { ...@@ -78,7 +78,7 @@ class StreamingListenerTest : public Test {
class FakeSocketWriter : public StreamingListener::AbstractSocketWriter { class FakeSocketWriter : public StreamingListener::AbstractSocketWriter {
public: public:
// Sends a string to the socket. // Sends a string to the socket.
virtual void Send(const std::string& message) { output_ += message; } void Send(const std::string& message) override { output_ += message; }
std::string output_; std::string output_;
}; };
...@@ -438,7 +438,7 @@ class FormatEpochTimeInMillisAsIso8601Test : public Test { ...@@ -438,7 +438,7 @@ class FormatEpochTimeInMillisAsIso8601Test : public Test {
static const TimeInMillis kMillisPerSec = 1000; static const TimeInMillis kMillisPerSec = 1000;
private: private:
virtual void SetUp() { void SetUp() override {
saved_tz_ = nullptr; saved_tz_ = nullptr;
GTEST_DISABLE_MSC_DEPRECATED_PUSH_(/* getenv, strdup: deprecated */) GTEST_DISABLE_MSC_DEPRECATED_PUSH_(/* getenv, strdup: deprecated */)
...@@ -452,7 +452,7 @@ class FormatEpochTimeInMillisAsIso8601Test : public Test { ...@@ -452,7 +452,7 @@ class FormatEpochTimeInMillisAsIso8601Test : public Test {
SetTimeZone("UTC+00"); SetTimeZone("UTC+00");
} }
virtual void TearDown() { void TearDown() override {
SetTimeZone(saved_tz_); SetTimeZone(saved_tz_);
free(const_cast<char*>(saved_tz_)); free(const_cast<char*>(saved_tz_));
saved_tz_ = nullptr; saved_tz_ = nullptr;
...@@ -1361,7 +1361,7 @@ class TestResultTest : public Test { ...@@ -1361,7 +1361,7 @@ class TestResultTest : public Test {
// ... and 3 TestResult objects. // ... and 3 TestResult objects.
TestResult * r0, * r1, * r2; TestResult * r0, * r1, * r2;
virtual void SetUp() { void SetUp() override {
// pr1 is for success. // pr1 is for success.
pr1 = new TestPartResult(TestPartResult::kSuccess, pr1 = new TestPartResult(TestPartResult::kSuccess,
"foo/bar.cc", "foo/bar.cc",
...@@ -1398,7 +1398,7 @@ class TestResultTest : public Test { ...@@ -1398,7 +1398,7 @@ class TestResultTest : public Test {
results2->push_back(*pr2); results2->push_back(*pr2);
} }
virtual void TearDown() { void TearDown() override {
delete pr1; delete pr1;
delete pr2; delete pr2;
...@@ -1826,12 +1826,12 @@ TEST(ShouldRunTestOnShardTest, IsPartitionWhenThereIsOneShard) { ...@@ -1826,12 +1826,12 @@ TEST(ShouldRunTestOnShardTest, IsPartitionWhenThereIsOneShard) {
class ShouldShardTest : public testing::Test { class ShouldShardTest : public testing::Test {
protected: protected:
virtual void SetUp() { void SetUp() override {
index_var_ = GTEST_FLAG_PREFIX_UPPER_ "INDEX"; index_var_ = GTEST_FLAG_PREFIX_UPPER_ "INDEX";
total_var_ = GTEST_FLAG_PREFIX_UPPER_ "TOTAL"; total_var_ = GTEST_FLAG_PREFIX_UPPER_ "TOTAL";
} }
virtual void TearDown() { void TearDown() override {
SetEnv(index_var_, ""); SetEnv(index_var_, "");
SetEnv(total_var_, ""); SetEnv(total_var_, "");
} }
...@@ -2094,7 +2094,7 @@ TEST_F(UnitTestRecordPropertyTest, ...@@ -2094,7 +2094,7 @@ TEST_F(UnitTestRecordPropertyTest,
class UnitTestRecordPropertyTestEnvironment : public Environment { class UnitTestRecordPropertyTestEnvironment : public Environment {
public: public:
virtual void TearDown() { void TearDown() override {
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase( ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
"tests"); "tests");
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase( ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
...@@ -2707,7 +2707,7 @@ class FloatingPointTest : public Test { ...@@ -2707,7 +2707,7 @@ class FloatingPointTest : public Test {
typedef typename testing::internal::FloatingPoint<RawType> Floating; typedef typename testing::internal::FloatingPoint<RawType> Floating;
typedef typename Floating::Bits Bits; typedef typename Floating::Bits Bits;
virtual void SetUp() { void SetUp() override {
const size_t max_ulps = Floating::kMaxUlps; const size_t max_ulps = Floating::kMaxUlps;
// The bits that represent 0.0. // The bits that represent 0.0.
...@@ -5061,7 +5061,7 @@ class TestLifeCycleTest : public Test { ...@@ -5061,7 +5061,7 @@ class TestLifeCycleTest : public Test {
// Destructor. Decrements the number of test objects that uses this // Destructor. Decrements the number of test objects that uses this
// fixture. // fixture.
~TestLifeCycleTest() { count_--; } ~TestLifeCycleTest() override { count_--; }
// Returns the number of live test objects that uses this fixture. // Returns the number of live test objects that uses this fixture.
int count() const { return count_; } int count() const { return count_; }
...@@ -5448,7 +5448,7 @@ class SetUpTestCaseTest : public Test { ...@@ -5448,7 +5448,7 @@ class SetUpTestCaseTest : public Test {
} }
// This will be called before each test in this test case. // This will be called before each test in this test case.
virtual void SetUp() { void SetUp() override {
// SetUpTestCase() should be called only once, so counter_ should // SetUpTestCase() should be called only once, so counter_ should
// always be 1. // always be 1.
EXPECT_EQ(1, counter_); EXPECT_EQ(1, counter_);
...@@ -5628,7 +5628,7 @@ struct Flags { ...@@ -5628,7 +5628,7 @@ struct Flags {
class ParseFlagsTest : public Test { class ParseFlagsTest : public Test {
protected: protected:
// Clears the flags before each test. // Clears the flags before each test.
virtual void SetUp() { void SetUp() override {
GTEST_FLAG(also_run_disabled_tests) = false; GTEST_FLAG(also_run_disabled_tests) = false;
GTEST_FLAG(break_on_failure) = false; GTEST_FLAG(break_on_failure) = false;
GTEST_FLAG(catch_exceptions) = false; GTEST_FLAG(catch_exceptions) = false;
...@@ -6316,12 +6316,8 @@ TEST(NestedTestingNamespaceTest, Failure) { ...@@ -6316,12 +6316,8 @@ TEST(NestedTestingNamespaceTest, Failure) {
// successfully. // successfully.
class ProtectedFixtureMethodsTest : public Test { class ProtectedFixtureMethodsTest : public Test {
protected: protected:
virtual void SetUp() { void SetUp() override { Test::SetUp(); }
Test::SetUp(); void TearDown() override { Test::TearDown(); }
}
virtual void TearDown() {
Test::TearDown();
}
}; };
// StreamingAssertionsTest tests the streaming versions of a representative // StreamingAssertionsTest tests the streaming versions of a representative
...@@ -6699,13 +6695,13 @@ class TestListener : public EmptyTestEventListener { ...@@ -6699,13 +6695,13 @@ class TestListener : public EmptyTestEventListener {
: on_start_counter_(on_start_counter), : on_start_counter_(on_start_counter),
is_destroyed_(is_destroyed) {} is_destroyed_(is_destroyed) {}
virtual ~TestListener() { ~TestListener() override {
if (is_destroyed_) if (is_destroyed_)
*is_destroyed_ = true; *is_destroyed_ = true;
} }
protected: protected:
virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) { void OnTestProgramStart(const UnitTest& /*unit_test*/) override {
if (on_start_counter_ != nullptr) (*on_start_counter_)++; if (on_start_counter_ != nullptr) (*on_start_counter_)++;
} }
...@@ -6774,21 +6770,21 @@ class SequenceTestingListener : public EmptyTestEventListener { ...@@ -6774,21 +6770,21 @@ class SequenceTestingListener : public EmptyTestEventListener {
: vector_(vector), id_(id) {} : vector_(vector), id_(id) {}
protected: protected:
virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) { void OnTestProgramStart(const UnitTest& /*unit_test*/) override {
vector_->push_back(GetEventDescription("OnTestProgramStart")); vector_->push_back(GetEventDescription("OnTestProgramStart"));
} }
virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) { void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {
vector_->push_back(GetEventDescription("OnTestProgramEnd")); vector_->push_back(GetEventDescription("OnTestProgramEnd"));
} }
virtual void OnTestIterationStart(const UnitTest& /*unit_test*/, void OnTestIterationStart(const UnitTest& /*unit_test*/,
int /*iteration*/) { int /*iteration*/) override {
vector_->push_back(GetEventDescription("OnTestIterationStart")); vector_->push_back(GetEventDescription("OnTestIterationStart"));
} }
virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/, void OnTestIterationEnd(const UnitTest& /*unit_test*/,
int /*iteration*/) { int /*iteration*/) override {
vector_->push_back(GetEventDescription("OnTestIterationEnd")); vector_->push_back(GetEventDescription("OnTestIterationEnd"));
} }
......
...@@ -34,12 +34,8 @@ ...@@ -34,12 +34,8 @@
class PropertyOne : public testing::Test { class PropertyOne : public testing::Test {
protected: protected:
virtual void SetUp() { void SetUp() override { RecordProperty("SetUpProp", 1); }
RecordProperty("SetUpProp", 1); void TearDown() override { RecordProperty("TearDownProp", 1); }
}
virtual void TearDown() {
RecordProperty("TearDownProp", 1);
}
}; };
TEST_F(PropertyOne, TestSomeProperties) { TEST_F(PropertyOne, TestSomeProperties) {
......
...@@ -34,12 +34,8 @@ ...@@ -34,12 +34,8 @@
class PropertyTwo : public testing::Test { class PropertyTwo : public testing::Test {
protected: protected:
virtual void SetUp() { void SetUp() override { RecordProperty("SetUpProp", 2); }
RecordProperty("SetUpProp", 2); void TearDown() override { RecordProperty("TearDownProp", 2); }
}
virtual void TearDown() {
RecordProperty("TearDownProp", 2);
}
}; };
TEST_F(PropertyTwo, TestSomeProperties) { TEST_F(PropertyTwo, TestSomeProperties) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment