summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAnatoly Galiulin <galiulin.anatoly@gmail.com>2016-12-29 11:22:50 +0700
committerAnatoly Galiulin <galiulin.anatoly@gmail.com>2016-12-29 17:27:03 +0700
commit8e71949b785ca2b2bc61d0f95c5ac88fa87621fe (patch)
tree15751fe701a510f50514142d60b6814519a7e533 /tests
parent46e4b4854e9cb564950e7802aaaaf1a2c8c8cab9 (diff)
downloadNim-8e71949b785ca2b2bc61d0f95c5ac88fa87621fe.tar.gz
Add pending operations presence check function, 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())
+