summary refs log tree commit diff stats
path: root/tests/async/tasyncfilewrite.nim
blob: 373b93301be9032e771311b47d2b4376befe709e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
discard """
  output: '''string 1
string 2
string 3'''
"""
# bug #5532
import os, asyncfile, asyncdispatch

const F = "test_async.txt"

removeFile(F)
defer: 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)