summary refs log tree commit diff stats
path: root/tests/async
diff options
context:
space:
mode:
Diffstat (limited to 'tests/async')
-rw-r--r--tests/async/t6100.nim15
-rw-r--r--tests/async/tfuturestream.nim2
2 files changed, 16 insertions, 1 deletions
diff --git a/tests/async/t6100.nim b/tests/async/t6100.nim
new file mode 100644
index 000000000..b4dc0f146
--- /dev/null
+++ b/tests/async/t6100.nim
@@ -0,0 +1,15 @@
+discard """
+  file: "t6100.nim"
+  exitcode: 0
+  output: "10000000"
+"""
+import asyncdispatch
+
+let done = newFuture[int]()
+done.complete(1)
+
+proc asyncSum: Future[int] {.async.} =
+  for _ in 1..10_000_000:
+    result += await done
+
+echo waitFor asyncSum()
\ No newline at end of file
diff --git a/tests/async/tfuturestream.nim b/tests/async/tfuturestream.nim
index 9a8e986a0..d76752b7e 100644
--- a/tests/async/tfuturestream.nim
+++ b/tests/async/tfuturestream.nim
@@ -18,8 +18,8 @@ var fs = newFutureStream[int]()
 
 proc alpha() {.async.} =
   for i in 0 .. 5:
-    await sleepAsync(1000)
     await fs.write(i)
+    await sleepAsync(1000)
 
   echo("Done")
   fs.complete()