fix
All checks were successful
linux-x64-gcc / linux-gcc (Release) (push) Successful in 1m46s
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 1m39s

This commit is contained in:
tqcq 2024-03-25 14:56:04 +08:00
parent 13cafbf4d1
commit 1396a20daf

View File

@ -41,13 +41,17 @@ TEST(Future, Except)
auto p = sled::Promise<int>(); auto p = sled::Promise<int>();
p.Resolve(1); p.Resolve(1);
p.GetFuture() p.GetFuture()
.Then([](int) { throw std::runtime_error("test"); }) .Then([](int) {
return 1;
// throw std::runtime_error("test");
})
.Except([](std::exception_ptr e) { .Except([](std::exception_ptr e) {
try { try {
std::rethrow_exception(e); std::rethrow_exception(e);
} catch (const std::exception &e) { } catch (const std::exception &e) {
EXPECT_STREQ(e.what(), "test"); EXPECT_STREQ(e.what(), "test");
} }
return false;
}) })
.Get(); .Get();
} }