test: make thread tests run fine also on Windows

This commit is contained in:
Michele Caini 2020-07-31 13:01:13 +02:00
parent 9ed3eaebd1
commit d2cc600e97

View File

@ -34,10 +34,24 @@ TEST(Mutex, LockUnlock) {
auto mtx = loop->resource<uvw::Mutex>();
mtx->lock();
#ifdef _MSC_VER
// this is allowed by libuv on Windows
ASSERT_TRUE(mtx->tryLock());
#else
ASSERT_FALSE(mtx->tryLock());
#endif
mtx->unlock();
ASSERT_TRUE(mtx->tryLock());
#ifdef _MSC_VER
// this is allowed by libuv on Windows
ASSERT_TRUE(mtx->tryLock());
#else
ASSERT_FALSE(mtx->tryLock());
#endif
mtx->unlock();
loop->run();