diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2014-05-04 21:04:07 +0100 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@googlemail.com> | 2014-05-04 21:04:07 +0100 |
commit | 88cb4850cea651f78612a12e3fd3ba704109b0b7 (patch) | |
tree | 5110436c418d888016707aff3d89c9a8a50cd64c /tests | |
parent | 93fed1f6d941fc42bd29e3edcef60b54f58a6f66 (diff) | |
parent | b1c865a656d6ee422f7d841a1e881874766a2b77 (diff) | |
download | Nim-88cb4850cea651f78612a12e3fd3ba704109b0b7.tar.gz |
Merge pull request #1175 from EXetoC/await-discard
Fix #1170.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/async/tasyncdiscard.nim | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/async/tasyncdiscard.nim b/tests/async/tasyncdiscard.nim new file mode 100644 index 000000000..48d8a8c4d --- /dev/null +++ b/tests/async/tasyncdiscard.nim @@ -0,0 +1,39 @@ +discard """ + output: ''' +1 +2 +3 +4 +1 +2 +1 +6 +''' +""" +import asyncio, asyncdispatch, asyncnet + +proc main {.async.} = + proc f: PFuture[int] {.async.} = + discard + echo 1 + discard + result = 2 + discard + + let x = await f() + echo x + echo 3 + + proc g: PFuture[int] {.async.} = + discard + echo 4 + discard + result = 6 + discard + echo await f() + discard await f() + + discard await g() + echo 6 + +main() |