Files
neovim/test/functional/autocmd/autocmd_spec.lua
ZyX ff470bb853 functests: Check logs in lua code
It is otherwise impossible to determine which test failed sanitizer/valgrind
check. test/functional/helpers.lua module return was changed so that tests which
do not provide after_each function to get new check will automatically fail.
2016-06-10 21:50:49 +03:00

32 lines
966 B
Lua

local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local command = helpers.command
local eval = helpers.eval
describe('autocmds:', function()
before_each(clear)
it(':tabnew triggers events in the correct order', function()
local expected = {
'WinLeave',
'TabLeave',
'TabNew',
'WinEnter',
'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)
end)