mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
functests: Move test from legacy/009 to autocmd/autocmd
This commit is contained in:
parent
1ef98b34b3
commit
b0731290e8
@ -5,6 +5,15 @@ local command = helpers.command
|
|||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local eval = helpers.eval
|
local eval = helpers.eval
|
||||||
|
|
||||||
|
local eq = helpers.eq
|
||||||
|
local eval = helpers.eval
|
||||||
|
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('autocmds:', function()
|
describe('autocmds:', function()
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
|
||||||
@ -33,4 +42,22 @@ describe('autocmds:', function()
|
|||||||
it('v:vim_did_enter is 1 after VimEnter', function()
|
it('v:vim_did_enter is 1 after VimEnter', function()
|
||||||
eq(1, eval('v:vim_did_enter'))
|
eq(1, eval('v:vim_did_enter'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
describe('BufLeave autocommand', function()
|
||||||
|
it('can wipe out the buffer created by :edit which triggered autocmd',
|
||||||
|
function()
|
||||||
|
meths.set_option('hidden', true)
|
||||||
|
curbufmeths.set_lines(0, 1, false, {
|
||||||
|
'start of test file xx',
|
||||||
|
'end of test file xx'})
|
||||||
|
|
||||||
|
command('autocmd BufLeave * bwipeout yy')
|
||||||
|
eq('Vim(edit):E143: Autocommands unexpectedly deleted new buffer yy',
|
||||||
|
exc_exec('edit yy'))
|
||||||
|
|
||||||
|
expect([[
|
||||||
|
start of test file xx
|
||||||
|
end of test file xx]])
|
||||||
|
end)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
-- Test for Bufleave autocommand that deletes the buffer we are about to edit.
|
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
|
||||||
|
|
||||||
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()
|
|
||||||
setup(clear)
|
|
||||||
|
|
||||||
it('is working', function()
|
|
||||||
meths.set_option('hidden', true)
|
|
||||||
curbufmeths.set_lines(0, 1, false, {
|
|
||||||
'start of test file xx',
|
|
||||||
'end of test file xx'})
|
|
||||||
|
|
||||||
command('autocmd BufLeave * bwipeout yy')
|
|
||||||
eq('Vim(edit):E143: Autocommands unexpectedly deleted new buffer yy',
|
|
||||||
exc_exec('edit yy'))
|
|
||||||
|
|
||||||
expect([[
|
|
||||||
start of test file xx
|
|
||||||
end of test file xx]])
|
|
||||||
end)
|
|
||||||
end)
|
|
Loading…
Reference in New Issue
Block a user