Commit fa2cd75d authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook Github Bot

update ExceptionWrapperTest to have better typeid checks

Summary:
Update the ExceptionWrapperTest to check typeid strings against the result of
calls to `demangle()`, rather than expecting `typeid(int)` to always be
demangled as the string "int".  When building with gcc-7.2 on Ubuntu 17.10
these type strings appear to be demangled simply as "i".

Reviewed By: yfeldblum

Differential Revision: D6817545

fbshipit-source-id: 134952106ad812f6980516247081bb9718b5ab38
parent 6bd3f255
......@@ -324,8 +324,8 @@ TEST(ExceptionWrapper, with_exception_ptr_any_test) {
EXPECT_TRUE(ew.has_exception_ptr());
EXPECT_EQ(ep, ew.to_exception_ptr());
EXPECT_TRUE(ew.has_exception_ptr());
EXPECT_EQ("int", ew.class_name());
EXPECT_EQ("int", ew.what());
EXPECT_EQ(demangle(typeid(int)), ew.class_name());
EXPECT_EQ(demangle(typeid(int)), ew.what());
EXPECT_FALSE(ew.is_compatible_with<std::exception>());
EXPECT_FALSE(ew.is_compatible_with<std::runtime_error>());
EXPECT_TRUE(ew.is_compatible_with<int>());
......@@ -353,12 +353,12 @@ TEST(ExceptionWrapper, with_non_std_exception_test) {
EXPECT_NE(nullptr, ew.get_exception<int>());
EXPECT_EQ(42, *ew.get_exception<int>());
EXPECT_TRUE(ew.has_exception_ptr());
EXPECT_EQ("int", ew.class_name());
EXPECT_EQ("int", ew.what());
EXPECT_EQ(demangle(typeid(int)), ew.class_name());
EXPECT_EQ(demangle(typeid(int)), ew.what());
EXPECT_NE(nullptr, ew.to_exception_ptr());
EXPECT_TRUE(ew.has_exception_ptr());
EXPECT_EQ("int", ew.class_name());
EXPECT_EQ("int", ew.what());
EXPECT_EQ(demangle(typeid(int)), ew.class_name());
EXPECT_EQ(demangle(typeid(int)), ew.what());
EXPECT_FALSE(ew.is_compatible_with<std::exception>());
EXPECT_FALSE(ew.is_compatible_with<std::runtime_error>());
EXPECT_TRUE(ew.is_compatible_with<int>());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment