neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

writefile_spec.lua (789B)


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