summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2016-12-30 11:06:38 +0000
committerGitHub <noreply@github.com>2016-12-30 11:06:38 +0000
commit09b6d8c0ca5f9b5590e58d90b987975f36df8dd6 (patch)
tree7d03896d1250a72d02ba3e4a39c4840ff1749768 /tests
parentcfea779e23bbcd586044cfe7be412dc87aad7c50 (diff)
parent8e71949b785ca2b2bc61d0f95c5ac88fa87621fe (diff)
downloadNim-09b6d8c0ca5f9b5590e58d90b987975f36df8dd6.tar.gz
Merge pull request #5163 from vegansk/5155-async
Adds pending operations presence check function to asyncdispatch, fixes #5155
Diffstat (limited to 'tests')
-rw-r--r--tests/async/tpendingcheck.nim21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/async/tpendingcheck.nim b/tests/async/tpendingcheck.nim
new file mode 100644
index 000000000..825acb613
--- /dev/null
+++ b/tests/async/tpendingcheck.nim
@@ -0,0 +1,21 @@
+discard """
+  file: "tpendingcheck.nim"
+  exitcode: 0
+  output: ""
+"""
+
+import asyncdispatch
+
+doAssert(not hasPendingOperations())
+
+proc test() {.async.} =
+  await sleepAsync(100)
+
+var f = test()
+while not f.finished:
+  doAssert(hasPendingOperations())
+  poll(10)
+f.read
+
+doAssert(not hasPendingOperations())
+