summary refs log tree commit diff stats
path: root/tests/async/tasyncfilewrite.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/async/tasyncfilewrite.nim')
-rw-r--r--tests/async/tasyncfilewrite.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/async/tasyncfilewrite.nim b/tests/async/tasyncfilewrite.nim
new file mode 100644
index 000000000..72a2df0b0
--- /dev/null
+++ b/tests/async/tasyncfilewrite.nim
@@ -0,0 +1,20 @@
+discard """
+  output: '''string 1
+string 2
+string 3
+'''
+"""
+# bug #5532
+import os, asyncfile, asyncdispatch
+
+const F = "test_async.txt"
+
+removeFile(F)
+let f = openAsync(F, fmWrite)
+var futs = newSeq[Future[void]]()
+for i in 1..3:
+  futs.add(f.write("string " & $i & "\n"))
+waitFor(all(futs))
+f.close()
+echo readFile(F)
+removeFile(F)