summaryrefslogtreecommitdiffstats
path: root/googletest/test
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2021-11-08 18:12:33 (GMT)
committerdinord <dino.radakovich@gmail.com>2021-11-09 15:24:05 (GMT)
commitc3792825bfb11490a61caa088692be95944c1faf (patch)
tree76b33fb4149cf739c1c6557607030e8af7456642 /googletest/test
parentd4e084a1cc1b9d86f34b410bc43d1a5b6739427d (diff)
downloadgoogletest-c3792825bfb11490a61caa088692be95944c1faf.zip
googletest-c3792825bfb11490a61caa088692be95944c1faf.tar.gz
googletest-c3792825bfb11490a61caa088692be95944c1faf.tar.bz2
Googletest export
Add printer for std::type_info. PiperOrigin-RevId: 408375407
Diffstat (limited to 'googletest/test')
-rw-r--r--googletest/test/googletest-printers-test.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/googletest/test/googletest-printers-test.cc b/googletest/test/googletest-printers-test.cc
index eb78eab..0058917 100644
--- a/googletest/test/googletest-printers-test.cc
+++ b/googletest/test/googletest-printers-test.cc
@@ -473,6 +473,16 @@ TEST(PrintBuiltInTypeTest, FloatingPoints) {
EXPECT_EQ("-2.5", Print(-2.5)); // double
}
+#if GTEST_HAS_RTTI
+TEST(PrintBuiltInTypeTest, TypeInfo) {
+ struct MyStruct {};
+ auto res = Print(typeid(MyStruct{}));
+ // We can't guarantee that we can demangle the name, but either name should
+ // contain the substring "MyStruct".
+ EXPECT_NE(res.find("MyStruct"), res.npos) << res;
+}
+#endif // GTEST_HAS_RTTI
+
// Since ::std::stringstream::operator<<(const void *) formats the pointer
// output differently with different compilers, we have to create the expected
// output first and use it as our expectation.