summary refs log tree commit diff stats
path: root/tests/async/tasync_in_seq_constr.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-06-05 19:58:00 +0200
committerGitHub <noreply@github.com>2018-06-05 19:58:00 +0200
commit3cbc07ac7877b03c605498760fe198e3200cc197 (patch)
tree627af3020528cb916b3174bd94304307ca875c77 /tests/async/tasync_in_seq_constr.nim
parentb1f483c897bb2a881c059dc473c81ec66b3a32fb (diff)
parentcfe40a3e6e920ed0c105af0012af739794c10b55 (diff)
downloadNim-3cbc07ac7877b03c605498760fe198e3200cc197.tar.gz
Merge pull request #7770 from yglukhov/yield-in-try
Yield in try
Diffstat (limited to 'tests/async/tasync_in_seq_constr.nim')
-rw-r--r--tests/async/tasync_in_seq_constr.nim21
1 files changed, 14 insertions, 7 deletions
diff --git a/tests/async/tasync_in_seq_constr.nim b/tests/async/tasync_in_seq_constr.nim
index 46ad74451..3d6dae245 100644
--- a/tests/async/tasync_in_seq_constr.nim
+++ b/tests/async/tasync_in_seq_constr.nim
@@ -1,18 +1,25 @@
 discard """
-  errormsg: "invalid control flow: 'yield' within a constructor"
-  line: 16
+  output: '''
+@[1, 2, 3, 4]
+123
+'''
 """
 
 # bug #5314, bug #6626
 
 import asyncdispatch
 
-proc bar(): Future[int] {.async.} =
-    await sleepAsync(500)
-    result = 3
+proc bar(i: int): Future[int] {.async.} =
+    await sleepAsync(2)
+    result = i
 
 proc foo(): Future[seq[int]] {.async.} =
-    await sleepAsync(500)
-    result = @[1, 2, await bar(), 4] # <--- The bug is here
+    await sleepAsync(2)
+    result = @[1, 2, await bar(3), 4] # <--- The bug is here
+
+proc foo2() {.async.} =
+    await sleepAsync(2)
+    echo(await bar(1), await bar(2), await bar(3))
 
 echo waitFor foo()
+waitFor foo2()