From 3313b54fc0025fdac0b7bb67cc1e8c599fe30641 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Wed, 10 Jan 2024 13:01:34 +0100 Subject: [PATCH] Fix: ensure that `eventually` works when std/times is imported --- asynctest/private/chronos/eventually.nim | 1 + testmodules/chronosv4/test.nim | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/asynctest/private/chronos/eventually.nim b/asynctest/private/chronos/eventually.nim index 352681c..e9ec0cf 100644 --- a/asynctest/private/chronos/eventually.nim +++ b/asynctest/private/chronos/eventually.nim @@ -1,6 +1,7 @@ import pkg/chronos template eventually*(expression: untyped, timeout=5000): bool = + bind Moment, now, milliseconds proc eventually: Future[bool] {.async.} = let endTime = Moment.now() + timeout.milliseconds diff --git a/testmodules/chronosv4/test.nim b/testmodules/chronosv4/test.nim index 6383c09..ef7c6f6 100644 --- a/testmodules/chronosv4/test.nim +++ b/testmodules/chronosv4/test.nim @@ -2,3 +2,10 @@ import pkg/asynctest/chronos/unittest include ../common/testbody include ../common/testfail + +import std/times + +suite "eventually and std/times": + + test "compiles when both chronos and std/times are imported": + check eventually true