Merge pull request #3928 from venik:venik-clean-up

PiperOrigin-RevId: 460455562
Change-Id: I29efc09887651d8734586703fe0691482ba4c981
This commit is contained in:
Copybara-Service 2022-07-12 07:19:18 -07:00
commit bea621c3c3
6 changed files with 8 additions and 9 deletions

View File

@ -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;
}

View File

@ -830,8 +830,7 @@ class TypeParameterizedTestSuite<Fixture, internal::None, Types> {
// 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.

View File

@ -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);

View File

@ -821,7 +821,7 @@ TEST_F(PREFIX_WITH_MACRO(NamingTestNonParametrized),
TEST(MacroNameing, LookupNames) {
std::set<std::string> 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<std::string> test_names;
for (int suite_num = 0; suite_num < unit_test->total_test_suite_count();
++suite_num) {

View File

@ -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());

View File

@ -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;