Add unit test for CanonicalizeForStdLibVersioning.

This commit is contained in:
James Dennett 2018-05-10 22:33:29 -07:00 committed by GitHub
parent 045e7f9ee4
commit b8fa4d2754
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -380,6 +380,31 @@ TEST(GetTestTypeIdTest, ReturnsTheSameValueInsideOrOutsideOfGoogleTest) {
EXPECT_EQ(kTestTypeIdInGoogleTest, GetTestTypeId());
}
// Tests CanonicalizeForStdLibVersioning.
using ::testing::internal::CanonicalizeForStdLibVersioning;
TEST(CanonicalizeForStdLibVersioning, LeavesUnversionedNamesUnchanged) {
EXPECT_EQ("std::bind", CanonicalizeForStdLibVersioning("std::bind"));
EXPECT_EQ("std::_", CanonicalizeForStdLibVersioning("std::_"));
EXPECT_EQ("std::__foo", CanonicalizeForStdLibVersioning("std::__foo"));
EXPECT_EQ("gtl::__1::x", CanonicalizeForStdLibVersioning("gtl::__1::x"));
EXPECT_EQ("__1::x", CanonicalizeForStdLibVersioning("__1::x"));
EXPECT_EQ("::__1::x", CanonicalizeForStdLibVersioning("::__1::x"));
}
TEST(CanonicalizeForStdLibVersioning, ElidesDoubleUnderNames) {
EXPECT_EQ("std::bind", CanonicalizeForStdLibVersioning("std::__1::bind"));
EXPECT_EQ("std::_", CanonicalizeForStdLibVersioning("std::__1::_"));
EXPECT_EQ("std::bind", CanonicalizeForStdLibVersioning("std::__g::bind"));
EXPECT_EQ("std::_", CanonicalizeForStdLibVersioning("std::__g::_"));
EXPECT_EQ("std::bind",
CanonicalizeForStdLibVersioning("std::__google::bind"));
EXPECT_EQ("std::_", CanonicalizeForStdLibVersioning("std::__google::_"));
}
// Tests FormatTimeInMillisAsSeconds().
TEST(FormatTimeInMillisAsSecondsTest, FormatsZero) {