diff --git a/googlemock/src/gmock-internal-utils.cc b/googlemock/src/gmock-internal-utils.cc index 0a74841f..f7d740c0 100644 --- a/googlemock/src/gmock-internal-utils.cc +++ b/googlemock/src/gmock-internal-utils.cc @@ -181,7 +181,7 @@ GTEST_API_ void Log(LogSeverity severity, const std::string& message, } std::cout << "Stack trace:\n" << ::testing::internal::GetCurrentOsStackTraceExceptTop( - ::testing::UnitTest::GetInstance(), actual_to_skip); + actual_to_skip); } std::cout << ::std::flush; } diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index fff148cc..74521db4 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -830,8 +830,7 @@ class TypeParameterizedTestSuite { // For example, if Foo() calls Bar(), which in turn calls // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't. -GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(UnitTest* unit_test, - int skip_count); +GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(int skip_count); // Helpers for suppressing warnings on unreachable code or constant // condition. diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 6efd8406..a1b2b5dc 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -6247,7 +6247,7 @@ void UnitTestImpl::UnshuffleTests() { // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't. GTEST_NO_INLINE_ GTEST_NO_TAIL_CALL_ std::string -GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/, int skip_count) { +GetCurrentOsStackTraceExceptTop(int skip_count) { // We pass skip_count + 1 to skip this wrapper function in addition // to what the user really wants to skip. return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1); diff --git a/googletest/test/googletest-param-test-test.cc b/googletest/test/googletest-param-test-test.cc index 848ef975..e3090ae4 100644 --- a/googletest/test/googletest-param-test-test.cc +++ b/googletest/test/googletest-param-test-test.cc @@ -821,7 +821,7 @@ TEST_F(PREFIX_WITH_MACRO(NamingTestNonParametrized), TEST(MacroNameing, LookupNames) { std::set know_suite_names, know_test_names; - auto ins = testing::UnitTest::GetInstance(); + const auto& ins = testing::UnitTest::GetInstance(); int ts = 0; while (const testing::TestSuite* suite = ins->GetTestSuite(ts++)) { know_suite_names.insert(suite->name()); @@ -897,7 +897,7 @@ INSTANTIATE_TEST_SUITE_P(CustomParamNameLambda, CustomLambdaNamingTest, }); TEST(CustomNamingTest, CheckNameRegistry) { - ::testing::UnitTest* unit_test = ::testing::UnitTest::GetInstance(); + const auto& unit_test = ::testing::UnitTest::GetInstance(); std::set test_names; for (int suite_num = 0; suite_num < unit_test->total_test_suite_count(); ++suite_num) { diff --git a/googletest/test/gtest-unittest-api_test.cc b/googletest/test/gtest-unittest-api_test.cc index 2a13fa32..2ea69273 100644 --- a/googletest/test/gtest-unittest-api_test.cc +++ b/googletest/test/gtest-unittest-api_test.cc @@ -106,7 +106,7 @@ const int kTypedTests = 1; // Since tests can be run in any order, the values the accessors that track // test execution (such as failed_test_count) can not be predicted. TEST(ApiTest, UnitTestImmutableAccessorsWork) { - UnitTest* unit_test = UnitTest::GetInstance(); + const auto& unit_test = UnitTest::GetInstance(); ASSERT_EQ(2 + kTypedTestSuites, unit_test->total_test_suite_count()); EXPECT_EQ(1 + kTypedTestSuites, unit_test->test_suite_to_run_count()); @@ -224,7 +224,7 @@ TEST(DISABLED_Test, Dummy2) {} class FinalSuccessChecker : public Environment { protected: void TearDown() override { - UnitTest* unit_test = UnitTest::GetInstance(); + const auto& unit_test = UnitTest::GetInstance(); EXPECT_EQ(1 + kTypedTestSuites, unit_test->successful_test_suite_count()); EXPECT_EQ(3 + kTypedTests, unit_test->successful_test_count()); diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index cdfdc6c4..b579e81e 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -7703,7 +7703,7 @@ auto* dynamic_test = testing::RegisterTest( __LINE__, []() -> DynamicUnitTestFixture* { return new DynamicTest; }); TEST(RegisterTest, WasRegistered) { - auto* unittest = testing::UnitTest::GetInstance(); + const auto& unittest = testing::UnitTest::GetInstance(); for (int i = 0; i < unittest->total_test_suite_count(); ++i) { auto* tests = unittest->GetTestSuite(i); if (tests->name() != std::string("DynamicUnitTestFixture")) continue;