Commit 54b16a23 authored by Subodh Iyengar's avatar Subodh Iyengar Committed by Facebook Github Bot

Add unit test for timeout=0

Summary:
Add unit test for immediate timeout since
we're using it in a few places.

Reviewed By: yfeldblum

Differential Revision: D6327012

fbshipit-source-id: ea80763d080b06e2a43277118d3147dc8016f348
parent 76cae471
......@@ -53,6 +53,20 @@ TEST(AsyncTimeout, schedule) {
EXPECT_EQ(expected, value);
}
TEST(AsyncTimeout, schedule_immediate) {
int value = 0;
int const expected = 10;
EventBase manager;
auto observer = AsyncTimeout::schedule(
std::chrono::milliseconds(0), manager, [&]() noexcept {
value = expected;
});
manager.loop();
EXPECT_EQ(expected, value);
}
TEST(AsyncTimeout, cancel_make) {
int value = 0;
int const expected = 10;
......
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