robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

master
878 B33 linesraw
1-- Tests for writefile()
2
3local n = require('test.functional.testnvim')()
4local t = require('test.testutil')
5
6local describe, it, setup = t.describe, t.it, t.setup
7local clear, command, expect = n.clear, n.command, n.expect
8
9describe('writefile', function()
10  setup(clear)
11
12  it('is working', function()
13    command('%delete _')
14    command('let f = tempname()')
15    command('call writefile(["over","written"], f, "b")')
16    command('call writefile(["hello","world"], f, "b")')
17    command('call writefile(["!", "good"], f, "a")')
18    command('call writefile(["morning"], f, "ab")')
19    command('call writefile(["", "vimmers"], f, "ab")')
20    command('bwipeout!')
21    command('$put =readfile(f)')
22    command('1 delete _')
23    command('call delete(f)')
24
25    -- Assert buffer contents.
26    expect([[
27      hello
28      world!
29      good
30      morning
31      vimmers]])
32  end)
33end)