1
2function! Test_WriteFile()
3  let f = tempname()
4  call writefile(["over","written"], f, "b")
5  call writefile(["hello","world"], f, "b")
6  call writefile(["!", "good"], f, "a")
7  call writefile(["morning"], f, "ab")
8  call writefile(["", "vimmers"], f, "ab")
9  let l = readfile(f)
10  call assert_equal("hello", l[0])
11  call assert_equal("world!", l[1])
12  call assert_equal("good", l[2])
13  call assert_equal("morning", l[3])
14  call assert_equal("vimmers", l[4])
15  call delete(f)
16endfunction
17