Commit f29e87cf authored by Nick Cooper's avatar Nick Cooper Committed by Facebook Github Bot

Improve blockingWait test

Summary: Previously if the loop simply failed to execute the test could pass, add some minor changes to ensure control flow is as required.

Reviewed By: andriigrynenko

Differential Revision: D19960864

fbshipit-source-id: 5a437d9e7d3b7c249cbf999fe7ea5eecfe668658
parent 0d305cb1
......@@ -274,17 +274,21 @@ struct ExpectedException {};
TEST_F(BlockingWaitTest, WaitTaskInFiberException) {
folly::EventBase evb;
auto& fm = folly::fibers::getFiberManager(evb);
fm.addTask([] {
EXPECT_TRUE(
fm.addTaskFuture([&] {
try {
folly::coro::blockingWait(
folly::coro::co_invoke([&]() -> folly::coro::Task<void> {
folly::via(co_await folly::coro::co_current_executor, []() {});
folly::via(
co_await folly::coro::co_current_executor, []() {});
throw ExpectedException();
}));
return false;
} catch (const ExpectedException&) {
return true;
}
});
evb.loop();
})
.getVia(&evb));
}
TEST_F(BlockingWaitTest, WaitOnSemiFuture) {
......
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