summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGennadiy Civil <misterg@google.com>2018-08-07 18:05:42 (GMT)
committerGennadiy Civil <misterg@google.com>2018-08-07 18:05:42 (GMT)
commit41e82cadf42d59c258473883073cdb4334abbc59 (patch)
treedb484324b7762ec23c7c79d7922770addbf333f6
parentb345bf9090961139971775105fa120cc87d63e44 (diff)
downloadgoogletest-41e82cadf42d59c258473883073cdb4334abbc59.zip
googletest-41e82cadf42d59c258473883073cdb4334abbc59.tar.gz
googletest-41e82cadf42d59c258473883073cdb4334abbc59.tar.bz2
upsream additional printer test
-rw-r--r--googletest/test/googletest-printers-test.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/googletest/test/googletest-printers-test.cc b/googletest/test/googletest-printers-test.cc
index 1b1026e..74825fc 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<double>{1.1}));
EXPECT_EQ("(\"A\")", PrintToString(absl::optional<std::string>{"A"}));
}
+
+struct NonPrintable {
+ unsigned char contents = 17;
+};
+
+TEST(PrintOneofTest, Basic) {
+ using Type = absl::variant<int, StreamableInGlobal, NonPrintable>;
+ 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