fixed tests: work

This commit is contained in:
Michele Caini 2017-06-15 17:39:58 +02:00
parent 9747599e3e
commit 68af870e50

View File

@ -41,7 +41,6 @@ TEST(Work, Cancellation) {
auto handle = loop->resource<uvw::CheckHandle>();
bool checkErrorEvent = false;
bool checkWorkEvent = false;
bool checkTask = false;
handle->on<uvw::CheckEvent>([](const auto &, auto &hndl) {
@ -59,9 +58,8 @@ TEST(Work, Cancellation) {
checkErrorEvent = true;
});
req->on<uvw::WorkEvent>([&checkWorkEvent](const auto &, auto &) {
ASSERT_FALSE(checkWorkEvent);
checkWorkEvent = true;
req->on<uvw::WorkEvent>([](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);
}