neovim/test/functional/autocmd/tabnew_spec.lua

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
799 B
Lua
Raw Normal View History

local helpers = require('test.functional.helpers')(after_each)
2016-03-01 18:27:41 -07:00
local clear = helpers.clear
local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
describe('autocmd TabNew', function()
before_each(clear)
it('matches when opening any new tab', function()
command('autocmd! TabNew * let g:test = "tabnew:".tabpagenr().":".bufnr("")')
command('tabnew')
eq('tabnew:2:1', eval('g:test'))
command('tabnew test.x')
eq('tabnew:3:2', eval('g:test'))
end)
it('matches when opening a new tab for FILE', function()
command('let g:test = "foo"')
2017-01-11 21:08:19 -07:00
command('autocmd! TabNew Xtest-tabnew let g:test = "bar"')
command('tabnew Xtest-tabnewX')
2016-03-01 18:27:41 -07:00
eq('foo', eval('g:test'))
2017-01-11 21:08:19 -07:00
command('tabnew Xtest-tabnew')
2016-03-01 18:27:41 -07:00
eq('bar', eval('g:test'))
end)
end)