make async test more reliable
This commit is contained in:
parent
e4902a4a35
commit
4c34787107
1 changed files with 5 additions and 3 deletions
|
|
@ -6,12 +6,14 @@ string 3'''
|
||||||
# bug #5532
|
# bug #5532
|
||||||
import os, asyncfile, asyncdispatch
|
import os, asyncfile, asyncdispatch
|
||||||
|
|
||||||
removeFile("test.txt")
|
const F = "test_async.txt"
|
||||||
let f = openAsync("test.txt", fmWrite)
|
|
||||||
|
removeFile(F)
|
||||||
|
let f = openAsync(F, fmWrite)
|
||||||
var futs = newSeq[Future[void]]()
|
var futs = newSeq[Future[void]]()
|
||||||
for i in 1..3:
|
for i in 1..3:
|
||||||
futs.add(f.write("string " & $i & "\n"))
|
futs.add(f.write("string " & $i & "\n"))
|
||||||
waitFor(all(futs))
|
waitFor(all(futs))
|
||||||
f.close()
|
f.close()
|
||||||
echo readFile("test.txt")
|
echo readFile(F)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue