summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/async/tpolltimeouts.nim19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/async/tpolltimeouts.nim b/tests/async/tpolltimeouts.nim
new file mode 100644
index 000000000..dac33732d
--- /dev/null
+++ b/tests/async/tpolltimeouts.nim
@@ -0,0 +1,19 @@
+discard """
+  output: "true"
+"""
+# Issue https://github.com/nim-lang/Nim/issues/4262
+import asyncdispatch, times
+
+proc foo(): Future[int] {.async.} =
+  return 1
+
+proc bar(): Future[int] {.async.} =
+  return await foo()
+
+let start = epochTime()
+let barFut = bar()
+
+while not barFut.finished:
+  poll(2000)
+
+echo(epochTime() - start < 1.0)