Extended tasync_in_seq_constr test
This commit is contained in:
parent
d71f69ab50
commit
7d38db284b
1 changed files with 14 additions and 6 deletions
|
|
@ -1,17 +1,25 @@
|
||||||
discard """
|
discard """
|
||||||
output: "@[1, 2, 3, 4]"
|
output: '''
|
||||||
|
@[1, 2, 3, 4]
|
||||||
|
123
|
||||||
|
'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# bug #5314, bug #6626
|
# bug #5314, bug #6626
|
||||||
|
|
||||||
import asyncdispatch
|
import asyncdispatch
|
||||||
|
|
||||||
proc bar(): Future[int] {.async.} =
|
proc bar(i: int): Future[int] {.async.} =
|
||||||
await sleepAsync(500)
|
await sleepAsync(2)
|
||||||
result = 3
|
result = i
|
||||||
|
|
||||||
proc foo(): Future[seq[int]] {.async.} =
|
proc foo(): Future[seq[int]] {.async.} =
|
||||||
await sleepAsync(500)
|
await sleepAsync(2)
|
||||||
result = @[1, 2, await bar(), 4] # <--- The bug is here
|
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()
|
echo waitFor foo()
|
||||||
|
waitFor foo2()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue