mirror of
https://github.com/neovim/neovim.git
synced 2025-01-02 17:33:28 -07:00
37 lines
1.1 KiB
Lua
37 lines
1.1 KiB
Lua
local helpers = require('test.functional.helpers')(after_each)
|
|
|
|
local clear = helpers.clear
|
|
local command = helpers.command
|
|
local eq = helpers.eq
|
|
local eval = helpers.eval
|
|
|
|
describe('autocmds:', function()
|
|
before_each(clear)
|
|
|
|
it(':tabnew triggers events in the correct order', function()
|
|
local expected = {
|
|
'WinLeave',
|
|
'TabLeave',
|
|
'WinEnter',
|
|
'TabNew',
|
|
'TabEnter',
|
|
'BufLeave',
|
|
'BufEnter'
|
|
}
|
|
command('let g:foo = []')
|
|
command('autocmd BufEnter * :call add(g:foo, "BufEnter")')
|
|
command('autocmd BufLeave * :call add(g:foo, "BufLeave")')
|
|
command('autocmd TabEnter * :call add(g:foo, "TabEnter")')
|
|
command('autocmd TabLeave * :call add(g:foo, "TabLeave")')
|
|
command('autocmd TabNew * :call add(g:foo, "TabNew")')
|
|
command('autocmd WinEnter * :call add(g:foo, "WinEnter")')
|
|
command('autocmd WinLeave * :call add(g:foo, "WinLeave")')
|
|
command('tabnew')
|
|
assert.same(expected, eval('g:foo'))
|
|
end)
|
|
|
|
it('v:vim_did_enter is 1 after VimEnter', function()
|
|
eq(1, eval('v:vim_did_enter'))
|
|
end)
|
|
end)
|