From d2cc600e97bca93e9e2ff15c9c019e3772e0cd6a Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Fri, 31 Jul 2020 13:01:13 +0200 Subject: [PATCH] test: make thread tests run fine also on Windows --- test/uvw/thread.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/uvw/thread.cpp b/test/uvw/thread.cpp index add6c7e8..f50c3207 100644 --- a/test/uvw/thread.cpp +++ b/test/uvw/thread.cpp @@ -34,10 +34,24 @@ TEST(Mutex, LockUnlock) { auto mtx = loop->resource(); 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();