mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
functests: Refactor 009_bufleave_autocommand_spec
It was not testing anything actually: the `e yy` command simply failed because of unsaved changes, BufLeave never run thus.
This commit is contained in:
parent
cd0a436622
commit
1ef98b34b3
@ -1,19 +1,27 @@
|
|||||||
-- Test for Bufleave autocommand that deletes the buffer we are about to edit.
|
-- Test for Bufleave autocommand that deletes the buffer we are about to edit.
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local clear, insert = helpers.clear, helpers.insert
|
|
||||||
local execute, expect = helpers.execute, helpers.expect
|
local eq = helpers.eq
|
||||||
|
local clear = helpers.clear
|
||||||
|
local meths = helpers.meths
|
||||||
|
local expect = helpers.expect
|
||||||
|
local command = helpers.command
|
||||||
|
local exc_exec = helpers.exc_exec
|
||||||
|
local curbufmeths = helpers.curbufmeths
|
||||||
|
|
||||||
describe('BufLeave autocommand', function()
|
describe('BufLeave autocommand', function()
|
||||||
setup(clear)
|
setup(clear)
|
||||||
|
|
||||||
it('is working', function()
|
it('is working', function()
|
||||||
insert([[
|
meths.set_option('hidden', true)
|
||||||
start of test file xx
|
curbufmeths.set_lines(0, 1, false, {
|
||||||
end of test file xx]])
|
'start of test file xx',
|
||||||
|
'end of test file xx'})
|
||||||
|
|
||||||
execute('au BufLeave * bwipe yy')
|
command('autocmd BufLeave * bwipeout yy')
|
||||||
execute('e yy')
|
eq('Vim(edit):E143: Autocommands unexpectedly deleted new buffer yy',
|
||||||
|
exc_exec('edit yy'))
|
||||||
|
|
||||||
expect([[
|
expect([[
|
||||||
start of test file xx
|
start of test file xx
|
||||||
|
Loading…
Reference in New Issue
Block a user