diff options
author | Gennadiy Civil <gennadiycivil@users.noreply.github.com> | 2018-08-07 11:18:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-07 11:18:54 -0700 |
commit | b95a702d5f5f25e76f61ba8f9140de7a37b91b11 (patch) | |
tree | db484324b7762ec23c7c79d7922770addbf333f6 | |
parent | 8506852a17ed8f092335e13889b21388790f0cc9 (diff) | |
parent | 094d7d292fdd43ba46799eb13d8887096ceba0b9 (diff) | |
download | googletest-b95a702d5f5f25e76f61ba8f9140de7a37b91b11.tar.gz googletest-b95a702d5f5f25e76f61ba8f9140de7a37b91b11.tar.bz2 googletest-b95a702d5f5f25e76f61ba8f9140de7a37b91b11.zip |
Merge pull request #1707 from gennadiycivil/master
upsream additional printer test
-rw-r--r-- | googletest/test/googletest-printers-test.cc | 15 |
1 files changed, 15 insertions, 0 deletions
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<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 |