specialize UniversalPrinter<> for std::any (without support for RTTI)

This commit is contained in:
Krystian Kuzniarek
2020-03-07 17:03:50 +01:00
parent 95b0ea2cf5
commit 843267f0f1
4 changed files with 72 additions and 0 deletions

View File

@@ -1531,6 +1531,27 @@ TEST(UniversalTersePrintTupleFieldsToStringsTestWithStd, PrintsTersely) {
EXPECT_EQ("\"a\"", result[1]);
}
#if GTEST_INTERNAL_HAS_ANY
TEST(PrintAnyTest, Empty) {
internal::Any any;
EXPECT_EQ("'any' type with no value", PrintToString(any));
}
TEST(PrintAnyTest, NonEmpty) {
internal::Any any;
constexpr int val1 = 10;
const std::string val2 = "content";
any = val1;
EXPECT_EQ("'any' type with value of type the element type",
PrintToString(any));
any = val2;
EXPECT_EQ("'any' type with value of type the element type",
PrintToString(any));
}
#endif // GTEST_INTERNAL_HAS_ANY
#if GTEST_INTERNAL_HAS_OPTIONAL
TEST(PrintOptionalTest, Basic) {
internal::Optional<int> value;