diff --git a/test/uvw/work.cpp b/test/uvw/work.cpp index 5f12c33c..81164a23 100644 --- a/test/uvw/work.cpp +++ b/test/uvw/work.cpp @@ -41,7 +41,6 @@ TEST(Work, Cancellation) { auto handle = loop->resource(); bool checkErrorEvent = false; - bool checkWorkEvent = false; bool checkTask = false; handle->on([](const auto &, auto &hndl) { @@ -59,9 +58,8 @@ TEST(Work, Cancellation) { checkErrorEvent = true; }); - req->on([&checkWorkEvent](const auto &, auto &) { - ASSERT_FALSE(checkWorkEvent); - checkWorkEvent = true; + req->on([](const auto &, auto &) { + while(true); /* it won't finish before the cancellation: guaranteed. */ }); handle->start(); @@ -70,6 +68,5 @@ TEST(Work, Cancellation) { loop->run(); ASSERT_TRUE(checkErrorEvent); - ASSERT_FALSE(checkWorkEvent); ASSERT_FALSE(checkTask); }