Commit 116ae463 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

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
parent 05db64e6
...@@ -95,13 +95,13 @@ TEST(Promise, setException) { ...@@ -95,13 +95,13 @@ TEST(Promise, setException) {
{ {
Promise<Unit> p; Promise<Unit> p;
auto f = p.getFuture(); auto f = p.getFuture();
try { p.setException(std::make_exception_ptr(eggs));
throw eggs; EXPECT_THROW(f.value(), eggs_t);
} catch (const std::exception& e) { }
p.setException(exception_wrapper(std::current_exception(), e)); {
} catch (...) { Promise<Unit> p;
p.setException(exception_wrapper(std::current_exception())); auto f = p.getFuture();
} p.setException(exception_wrapper(eggs));
EXPECT_THROW(f.value(), eggs_t); EXPECT_THROW(f.value(), eggs_t);
} }
} }
......
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