From 6ad917493d7a8362d27f79a66cde4f9d8a09a235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Mon, 19 Dec 2016 22:21:51 +0100 Subject: [PATCH] Improve timer test diagnostics. --- tests/0-timer.d | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/0-timer.d b/tests/0-timer.d index b90931f..264b68c 100644 --- a/tests/0-timer.d +++ b/tests/0-timer.d @@ -29,16 +29,19 @@ void main() eventDriver.timers.set(tm, 100.msecs, 100.msecs); void secondTier(TimerID timer) nothrow @safe { - scope (failure) assert(false); - auto dur = Clock.currTime(UTC()) - s_startTime; - s_cnt++; - assert(dur > 100.msecs * s_cnt); - assert(dur < 100.msecs * s_cnt + 20.msecs); + try { + auto dur = Clock.currTime(UTC()) - s_startTime; + s_cnt++; + assert(dur > 100.msecs * s_cnt); + assert(dur < 100.msecs * s_cnt + 20.msecs); - if (s_cnt == 3) { - s_done = true; - eventDriver.core.exit(); - } else eventDriver.timers.wait(tm, &secondTier); + if (s_cnt == 3) { + s_done = true; + eventDriver.core.exit(); + } else eventDriver.timers.wait(tm, &secondTier); + } catch (Exception e) { + assert(false, e.msg); + } } eventDriver.timers.wait(tm, &secondTier);