Files
Nim/tests/async/tasyncfilewrite.nim
Timothee Cour b809562c7c make megatest consistent with unjoined tests wrt newlines, honor newlines in output spec (#16151)
* fix megatest newlines
* still allow missing trailing newline for now but in a more strict way than before
2020-11-28 09:09:31 +01:00

21 lines
333 B
Nim

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)