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