mirror of
https://github.com/neovim/neovim.git
synced 2025-01-01 17:23:36 -07:00
65fb622000
Hope this will make people using feed_command less likely: this hides bugs. Already found at least two: 1. msgpackparse() will show internal error: hash_add() in case of duplicate keys, though it will still work correctly. Currently silenced. 2. ttimeoutlen was spelled incorrectly, resulting in option not being set when expected. Test was still functioning somehow though. Currently fixed.
72 lines
1.7 KiB
Lua
72 lines
1.7 KiB
Lua
-- Test for autocommand that deletes the current buffer on BufLeave event.
|
|
-- Also test deleting the last buffer, should give a new, empty buffer.
|
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
|
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
|
|
local command, expect = helpers.command, helpers.expect
|
|
local wait = helpers.wait
|
|
|
|
describe('test5', function()
|
|
setup(clear)
|
|
|
|
it('is working', function()
|
|
insert([[
|
|
start of test file Xxx
|
|
vim: set noai :
|
|
this is a test
|
|
this is a test
|
|
this is a test
|
|
this is a test
|
|
end of test file Xxx]])
|
|
|
|
command('w! Xxx0')
|
|
command('au BufLeave Xxx bwipe')
|
|
command('/start of')
|
|
|
|
-- Write test file Xxx.
|
|
command('.,/end of/w! Xxx')
|
|
|
|
-- Split to Xxx.
|
|
command('sp Xxx')
|
|
|
|
-- Delete buffer Xxx, now we're back here.
|
|
command('bwipe')
|
|
feed('G?this is a<cr>')
|
|
feed('othis is some more text<esc>')
|
|
wait()
|
|
|
|
-- Append some text to this file.
|
|
|
|
-- Write current file contents.
|
|
command('?start?,$yank A')
|
|
|
|
-- Delete current buffer, get an empty one.
|
|
command('bwipe!')
|
|
-- Append an extra line to the output register.
|
|
feed('ithis is another test line<esc>:yank A<cr>')
|
|
wait()
|
|
|
|
-- Output results
|
|
command('%d')
|
|
command('0put a')
|
|
command('$d')
|
|
|
|
-- Assert buffer contents.
|
|
expect([[
|
|
start of test file Xxx
|
|
vim: set noai :
|
|
this is a test
|
|
this is a test
|
|
this is a test
|
|
this is a test
|
|
this is some more text
|
|
end of test file Xxx
|
|
this is another test line]])
|
|
end)
|
|
|
|
teardown(function()
|
|
os.remove('Xxx')
|
|
os.remove('Xxx0')
|
|
end)
|
|
end)
|