fix Except
This commit is contained in:
@@ -35,3 +35,19 @@ TEST(Future, Basic)
|
||||
p.Resolve(1);
|
||||
EXPECT_EQ(future.Get(), 21);
|
||||
}
|
||||
|
||||
TEST(Future, Except)
|
||||
{
|
||||
auto p = sled::Promise<int>();
|
||||
p.Resolve(1);
|
||||
p.GetFuture()
|
||||
.Then([](int) { throw std::runtime_error("test"); })
|
||||
.Except([](std::exception_ptr e) {
|
||||
try {
|
||||
std::rethrow_exception(e);
|
||||
} catch (const std::exception &e) {
|
||||
EXPECT_STREQ(e.what(), "test");
|
||||
}
|
||||
})
|
||||
.Get();
|
||||
}
|
||||
|
Reference in New Issue
Block a user