EXPECT_EQ(exception_wrapper::none(), ew.type());
EXPECT_FALSE(bool(ew));
EXPECT_EQ(nullptr, ew.get_exception());
+ EXPECT_EQ(nullptr, ew.get_object<std::exception>());
+ EXPECT_EQ(nullptr, ew.get_object<int>());
EXPECT_FALSE(ew.has_exception_ptr());
EXPECT_EQ(nullptr, ew.to_exception_ptr());
EXPECT_FALSE(ew.has_exception_ptr());
EXPECT_TRUE(bool(ew));
EXPECT_EQ(typeid(std::runtime_error), ew.type());
EXPECT_NE(nullptr, ew.get_exception());
+ EXPECT_NE(nullptr, ew.get_object<std::exception>());
+ EXPECT_EQ(nullptr, ew.get_object<int>());
EXPECT_FALSE(ew.has_exception_ptr());
EXPECT_NE(nullptr, ew.to_exception_ptr());
EXPECT_TRUE(ew.has_exception_ptr());
EXPECT_FALSE(bool(ew));
EXPECT_EQ(exception_wrapper::none(), ew.type());
EXPECT_EQ(nullptr, ew.get_exception());
+ EXPECT_EQ(nullptr, ew.get_object<std::exception>());
+ EXPECT_EQ(nullptr, ew.get_object<int>());
EXPECT_EQ(nullptr, ew.to_exception_ptr());
EXPECT_EQ("", ew.class_name());
EXPECT_EQ("", ew.what());
EXPECT_TRUE(bool(ew));
EXPECT_EQ(typeid(std::runtime_error), ew.type());
EXPECT_NE(nullptr, ew.get_exception());
+ EXPECT_NE(nullptr, ew.get_object<std::exception>());
+ EXPECT_EQ(nullptr, ew.get_object<int>());
EXPECT_TRUE(ew.has_exception_ptr());
EXPECT_EQ(ep, ew.to_exception_ptr());
EXPECT_TRUE(ew.has_exception_ptr());
EXPECT_FALSE(bool(ew));
EXPECT_EQ(exception_wrapper::none(), ew.type());
EXPECT_EQ(nullptr, ew.get_exception());
+ EXPECT_EQ(nullptr, ew.get_object<std::exception>());
+ EXPECT_EQ(nullptr, ew.get_object<int>());
EXPECT_EQ(nullptr, ew.to_exception_ptr());
EXPECT_EQ("", ew.class_name());
EXPECT_EQ("", ew.what());
auto ew = exception_wrapper(ep, from_eptr<int>(ep));
EXPECT_TRUE(bool(ew));
EXPECT_EQ(nullptr, ew.get_exception());
+ EXPECT_EQ(nullptr, ew.get_object<std::exception>());
+ EXPECT_NE(nullptr, ew.get_object<int>());
EXPECT_TRUE(ew.has_exception_ptr());
EXPECT_EQ(ep, ew.to_exception_ptr());
EXPECT_TRUE(ew.has_exception_ptr());
exception_wrapper(std::move(ew));
EXPECT_FALSE(bool(ew));
EXPECT_EQ(nullptr, ew.get_exception());
+ EXPECT_EQ(nullptr, ew.get_object<std::exception>());
+ EXPECT_EQ(nullptr, ew.get_object<int>());
EXPECT_EQ(nullptr, ew.to_exception_ptr());
EXPECT_FALSE(ew.has_exception_ptr());
EXPECT_EQ("", ew.class_name());
auto ew = exception_wrapper(folly::in_place, 42);
EXPECT_TRUE(bool(ew));
EXPECT_EQ(nullptr, ew.get_exception());
+ EXPECT_EQ(nullptr, ew.get_object<std::exception>());
+ EXPECT_NE(nullptr, ew.get_object<int>());
EXPECT_FALSE(ew.has_exception_ptr());
EXPECT_EQ("int", ew.class_name());
EXPECT_EQ("int", ew.what());
exception_wrapper(std::move(ew));
EXPECT_FALSE(bool(ew));
EXPECT_EQ(nullptr, ew.get_exception());
+ EXPECT_EQ(nullptr, ew.get_object<std::exception>());
+ EXPECT_EQ(nullptr, ew.get_object<int>());
EXPECT_EQ(nullptr, ew.to_exception_ptr());
EXPECT_FALSE(ew.has_exception_ptr());
EXPECT_EQ("", ew.class_name());
auto ew = exception_wrapper(ep); // concrete type is erased
EXPECT_TRUE(bool(ew));
EXPECT_EQ(nullptr, ew.get_exception());
+ EXPECT_EQ(nullptr, ew.get_object<std::exception>());
+ EXPECT_NE(nullptr, ew.get_object<int>());
EXPECT_EQ(ep, ew.to_exception_ptr());
EXPECT_EQ("<unknown exception>", ew.class_name()); // because concrete type is
// erased
exception_wrapper(std::move(ew));
EXPECT_FALSE(bool(ew));
EXPECT_EQ(nullptr, ew.get_exception());
+ EXPECT_EQ(nullptr, ew.get_object<std::exception>());
+ EXPECT_EQ(nullptr, ew.get_object<int>());
EXPECT_EQ(nullptr, ew.to_exception_ptr());
EXPECT_EQ("", ew.class_name());
EXPECT_EQ("", ew.what());