From: Yedidya Feldblum Date: Tue, 22 Aug 2017 22:51:49 +0000 (-0700) Subject: Use simple exception_wrapper ctor in the Promise::setException test X-Git-Tag: v2017.08.28.00~15 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=116ae4634a0287e35f378cb4c68c1ed7a48668ec;p=folly.git Use simple exception_wrapper ctor in the Promise::setException test Summary: [Folly] Use simple `exception_wrapper` ctor in the `Promise::setException` test. And add a new case testing with `exception_ptr`. Reviewed By: andrewjcg Differential Revision: D5683035 fbshipit-source-id: e8276166dacbe09a9a745271d636db44c593058c --- diff --git a/folly/futures/test/PromiseTest.cpp b/folly/futures/test/PromiseTest.cpp index 224fc73f..3f41c072 100644 --- a/folly/futures/test/PromiseTest.cpp +++ b/folly/futures/test/PromiseTest.cpp @@ -95,13 +95,13 @@ TEST(Promise, setException) { { Promise p; auto f = p.getFuture(); - try { - throw eggs; - } catch (const std::exception& e) { - p.setException(exception_wrapper(std::current_exception(), e)); - } catch (...) { - p.setException(exception_wrapper(std::current_exception())); - } + p.setException(std::make_exception_ptr(eggs)); + EXPECT_THROW(f.value(), eggs_t); + } + { + Promise p; + auto f = p.getFuture(); + p.setException(exception_wrapper(eggs)); EXPECT_THROW(f.value(), eggs_t); } }