Skip to content

Commit 7107c44

Browse files
committed
cleanup from unique_ptr branch
1 parent 4219e72 commit 7107c44

File tree

6 files changed

+8
-10
lines changed

6 files changed

+8
-10
lines changed

googlemock/src/gmock-internal-utils.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ GTEST_API_ void Log(LogSeverity severity, const std::string& message,
180180
std::cout << "\n";
181181
}
182182
std::cout << "Stack trace:\n"
183-
<< ::testing::internal::GetCurrentOsStackTraceExceptTop(
184-
::testing::UnitTest::GetInstance(), actual_to_skip);
183+
<< ::testing::internal::GetCurrentOsStackTraceExceptTop(actual_to_skip);
185184
}
186185
std::cout << ::std::flush;
187186
}

googletest/include/gtest/internal/gtest-internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,8 +829,7 @@ class TypeParameterizedTestSuite<Fixture, internal::None, Types> {
829829
// For example, if Foo() calls Bar(), which in turn calls
830830
// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
831831
// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
832-
GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(UnitTest* unit_test,
833-
int skip_count);
832+
GTEST_API_ std::string GetCurrentOsStackTraceExceptTop(int skip_count);
834833

835834
// Helpers for suppressing warnings on unreachable code or constant
836835
// condition.

googletest/src/gtest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6245,7 +6245,7 @@ void UnitTestImpl::UnshuffleTests() {
62456245
// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
62466246
// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
62476247
GTEST_NO_INLINE_ GTEST_NO_TAIL_CALL_ std::string
6248-
GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/, int skip_count) {
6248+
GetCurrentOsStackTraceExceptTop(int skip_count) {
62496249
// We pass skip_count + 1 to skip this wrapper function in addition
62506250
// to what the user really wants to skip.
62516251
return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1);

googletest/test/googletest-param-test-test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ TEST_F(PREFIX_WITH_MACRO(NamingTestNonParametrized),
821821
TEST(MacroNameing, LookupNames) {
822822
std::set<std::string> know_suite_names, know_test_names;
823823

824-
auto ins = testing::UnitTest::GetInstance();
824+
const auto& ins = testing::UnitTest::GetInstance();
825825
int ts = 0;
826826
while (const testing::TestSuite* suite = ins->GetTestSuite(ts++)) {
827827
know_suite_names.insert(suite->name());
@@ -897,7 +897,7 @@ INSTANTIATE_TEST_SUITE_P(CustomParamNameLambda, CustomLambdaNamingTest,
897897
});
898898

899899
TEST(CustomNamingTest, CheckNameRegistry) {
900-
::testing::UnitTest* unit_test = ::testing::UnitTest::GetInstance();
900+
const auto& unit_test = ::testing::UnitTest::GetInstance();
901901
std::set<std::string> test_names;
902902
for (int suite_num = 0; suite_num < unit_test->total_test_suite_count();
903903
++suite_num) {

googletest/test/gtest-unittest-api_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const int kTypedTests = 1;
106106
// Since tests can be run in any order, the values the accessors that track
107107
// test execution (such as failed_test_count) can not be predicted.
108108
TEST(ApiTest, UnitTestImmutableAccessorsWork) {
109-
UnitTest* unit_test = UnitTest::GetInstance();
109+
const auto& unit_test = UnitTest::GetInstance();
110110

111111
ASSERT_EQ(2 + kTypedTestSuites, unit_test->total_test_suite_count());
112112
EXPECT_EQ(1 + kTypedTestSuites, unit_test->test_suite_to_run_count());
@@ -224,7 +224,7 @@ TEST(DISABLED_Test, Dummy2) {}
224224
class FinalSuccessChecker : public Environment {
225225
protected:
226226
void TearDown() override {
227-
UnitTest* unit_test = UnitTest::GetInstance();
227+
const auto& unit_test = UnitTest::GetInstance();
228228

229229
EXPECT_EQ(1 + kTypedTestSuites, unit_test->successful_test_suite_count());
230230
EXPECT_EQ(3 + kTypedTests, unit_test->successful_test_count());

googletest/test/gtest_unittest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7703,7 +7703,7 @@ auto* dynamic_test = testing::RegisterTest(
77037703
__LINE__, []() -> DynamicUnitTestFixture* { return new DynamicTest; });
77047704

77057705
TEST(RegisterTest, WasRegistered) {
7706-
auto* unittest = testing::UnitTest::GetInstance();
7706+
const auto& unittest = testing::UnitTest::GetInstance();
77077707
for (int i = 0; i < unittest->total_test_suite_count(); ++i) {
77087708
auto* tests = unittest->GetTestSuite(i);
77097709
if (tests->name() != std::string("DynamicUnitTestFixture")) continue;

0 commit comments

Comments
 (0)