summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@gmail.com>2017-02-09 22:46:20 +0100
committerDominik Picheta <dominikpicheta@gmail.com>2017-02-09 22:46:20 +0100
commite189004a03fc10a5330caf853f7a287636f679fd (patch)
tree9e9b17aff6b5558f28c76b78a3fa775bdcbced9b /tests
parenta20b4c674e9ee27d0ebb1da0163d7d3664808897 (diff)
downloadNim-e189004a03fc10a5330caf853f7a287636f679fd.tar.gz
WIP implementation of FutureStream.
Diffstat (limited to 'tests')
-rw-r--r--tests/async/tfuturestream.nim19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/async/tfuturestream.nim b/tests/async/tfuturestream.nim
new file mode 100644
index 000000000..ed5ac5785
--- /dev/null
+++ b/tests/async/tfuturestream.nim
@@ -0,0 +1,19 @@
+import asyncdispatch
+
+var fs = newFutureStream[string]()
+
+proc alpha() {.async.} =
+  for i in 0 .. 5:
+    fs.put($i)
+    await sleepAsync(1000)
+
+  fs.complete()
+
+proc beta() {.async.} =
+  while not fs.finished():
+    echo(await fs.takeAsync())
+
+  echo("Finished")
+
+asyncCheck alpha()
+asyncCheck beta()
\ No newline at end of file