From 41e82cadf42d59c258473883073cdb4334abbc59 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Tue, 7 Aug 2018 14:05:42 -0400 Subject: [PATCH] upsream additional printer test --- googletest/test/googletest-printers-test.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/googletest/test/googletest-printers-test.cc b/googletest/test/googletest-printers-test.cc index 1b1026e7..74825fc2 100644 --- a/googletest/test/googletest-printers-test.cc +++ b/googletest/test/googletest-printers-test.cc @@ -1731,6 +1731,21 @@ TEST(PrintOptionalTest, Basic) { EXPECT_EQ("(1.1)", PrintToString(absl::optional{1.1})); EXPECT_EQ("(\"A\")", PrintToString(absl::optional{"A"})); } + +struct NonPrintable { + unsigned char contents = 17; +}; + +TEST(PrintOneofTest, Basic) { + using Type = absl::variant; + EXPECT_EQ("('int' with value 7)", PrintToString(Type(7))); + EXPECT_EQ("('StreamableInGlobal' with value StreamableInGlobal)", + PrintToString(Type(StreamableInGlobal{}))); + EXPECT_EQ( + "('testing::gtest_printers_test::NonPrintable' with value 1-byte object " + "<11>)", + PrintToString(Type(NonPrintable{}))); +} #endif // GTEST_HAS_ABSL } // namespace gtest_printers_test