Commit 00d1ffc8 by Abseil Team Committed by Gennadiy Civil

Googletest export

Fix the typed test names in the tests for customized typed test parameters. As required by googletest documentation, the names should not contain an underscore. PiperOrigin-RevId: 210678652
parent 2cc00853
...@@ -96,7 +96,7 @@ TYPED_TEST(FooTest, HasPropertyA) { ... } ...@@ -96,7 +96,7 @@ TYPED_TEST(FooTest, HasPropertyA) { ... }
// static std::string GetName(int) { // static std::string GetName(int) {
// if (std::is_same<T, char>()) return "char"; // if (std::is_same<T, char>()) return "char";
// if (std::is_same<T, int>()) return "int"; // if (std::is_same<T, int>()) return "int";
// if (std::is_same<T, unsigned int>()) return "unsigned_int"; // if (std::is_same<T, unsigned int>()) return "unsignedInt";
// } // }
// }; // };
// TYPED_TEST_CASE(FooTest, MyTypes, MyTypeNames); // TYPED_TEST_CASE(FooTest, MyTypes, MyTypeNames);
......
...@@ -811,9 +811,9 @@ class TypedTestNames { ...@@ -811,9 +811,9 @@ class TypedTestNames {
template <typename T> template <typename T>
static std::string GetName(int i) { static std::string GetName(int i) {
if (testing::internal::IsSame<T, char>::value) if (testing::internal::IsSame<T, char>::value)
return std::string("char_") + ::testing::PrintToString(i); return std::string("char") + ::testing::PrintToString(i);
if (testing::internal::IsSame<T, int>::value) if (testing::internal::IsSame<T, int>::value)
return std::string("int_") + ::testing::PrintToString(i); return std::string("int") + ::testing::PrintToString(i);
} }
}; };
...@@ -852,10 +852,10 @@ class TypedTestPNames { ...@@ -852,10 +852,10 @@ class TypedTestPNames {
template <typename T> template <typename T>
static std::string GetName(int i) { static std::string GetName(int i) {
if (testing::internal::IsSame<T, unsigned char>::value) { if (testing::internal::IsSame<T, unsigned char>::value) {
return std::string("unsigned_char_") + ::testing::PrintToString(i); return std::string("unsignedChar") + ::testing::PrintToString(i);
} }
if (testing::internal::IsSame<T, unsigned int>::value) { if (testing::internal::IsSame<T, unsigned int>::value) {
return std::string("unsigned_int_") + ::testing::PrintToString(i); return std::string("unsignedInt") + ::testing::PrintToString(i);
} }
} }
}; };
......
...@@ -174,10 +174,10 @@ class TypedTestNames { ...@@ -174,10 +174,10 @@ class TypedTestNames {
template <typename T> template <typename T>
static std::string GetName(int i) { static std::string GetName(int i) {
if (testing::internal::IsSame<T, char>::value) { if (testing::internal::IsSame<T, char>::value) {
return std::string("char_") + ::testing::PrintToString(i); return std::string("char") + ::testing::PrintToString(i);
} }
if (testing::internal::IsSame<T, int>::value) { if (testing::internal::IsSame<T, int>::value) {
return std::string("int_") + ::testing::PrintToString(i); return std::string("int") + ::testing::PrintToString(i);
} }
} }
}; };
...@@ -189,13 +189,13 @@ TYPED_TEST(TypedTestWithNames, TestCaseName) { ...@@ -189,13 +189,13 @@ TYPED_TEST(TypedTestWithNames, TestCaseName) {
EXPECT_STREQ(::testing::UnitTest::GetInstance() EXPECT_STREQ(::testing::UnitTest::GetInstance()
->current_test_info() ->current_test_info()
->test_case_name(), ->test_case_name(),
"TypedTestWithNames/char_0"); "TypedTestWithNames/char0");
} }
if (testing::internal::IsSame<TypeParam, int>::value) { if (testing::internal::IsSame<TypeParam, int>::value) {
EXPECT_STREQ(::testing::UnitTest::GetInstance() EXPECT_STREQ(::testing::UnitTest::GetInstance()
->current_test_info() ->current_test_info()
->test_case_name(), ->test_case_name(),
"TypedTestWithNames/int_1"); "TypedTestWithNames/int1");
} }
} }
...@@ -311,13 +311,13 @@ TYPED_TEST_P(TypeParametrizedTestWithNames, TestCaseName) { ...@@ -311,13 +311,13 @@ TYPED_TEST_P(TypeParametrizedTestWithNames, TestCaseName) {
EXPECT_STREQ(::testing::UnitTest::GetInstance() EXPECT_STREQ(::testing::UnitTest::GetInstance()
->current_test_info() ->current_test_info()
->test_case_name(), ->test_case_name(),
"CustomName/TypeParametrizedTestWithNames/p_char_0"); "CustomName/TypeParametrizedTestWithNames/parChar0");
} }
if (testing::internal::IsSame<TypeParam, int>::value) { if (testing::internal::IsSame<TypeParam, int>::value) {
EXPECT_STREQ(::testing::UnitTest::GetInstance() EXPECT_STREQ(::testing::UnitTest::GetInstance()
->current_test_info() ->current_test_info()
->test_case_name(), ->test_case_name(),
"CustomName/TypeParametrizedTestWithNames/p_int_1"); "CustomName/TypeParametrizedTestWithNames/parInt1");
} }
} }
...@@ -328,10 +328,10 @@ class TypeParametrizedTestNames { ...@@ -328,10 +328,10 @@ class TypeParametrizedTestNames {
template <typename T> template <typename T>
static std::string GetName(int i) { static std::string GetName(int i) {
if (testing::internal::IsSame<T, char>::value) { if (testing::internal::IsSame<T, char>::value) {
return std::string("p_char_") + ::testing::PrintToString(i); return std::string("parChar") + ::testing::PrintToString(i);
} }
if (testing::internal::IsSame<T, int>::value) { if (testing::internal::IsSame<T, int>::value) {
return std::string("p_int_") + ::testing::PrintToString(i); return std::string("parInt") + ::testing::PrintToString(i);
} }
} }
}; };
......
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