make async test more reliable

This commit is contained in:
Araq
2018-09-15 12:21:01 +02:00
parent e4902a4a35
commit 4c34787107

View File

@@ -6,12 +6,14 @@ string 3'''
# bug #5532
import os, asyncfile, asyncdispatch
removeFile("test.txt")
let f = openAsync("test.txt", fmWrite)
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("test.txt")
echo readFile(F)