mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
Extended tasync_in_seq_constr test
This commit is contained in:
@@ -1,17 +1,25 @@
|
||||
discard """
|
||||
output: "@[1, 2, 3, 4]"
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user