diff options
Diffstat (limited to 'tests/async/t14820.nim')
-rw-r--r-- | tests/async/t14820.nim | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/async/t14820.nim b/tests/async/t14820.nim new file mode 100644 index 000000000..359884468 --- /dev/null +++ b/tests/async/t14820.nim @@ -0,0 +1,25 @@ +discard """ +output: ''' +iteration: 1 +iteration: 2 +iteration: 3 +iteration: 4 +async done +iteration: 5 +''' +""" + +import asyncdispatch, times + +var done = false +proc somethingAsync() {.async.} = + yield sleepAsync 5000 + echo "async done" + done = true + +asyncCheck somethingAsync() +var count = 0 +while not done: + count += 1 + drain 1000 + echo "iteration: ", count |