2016-04-23 16:53:11 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2014-12-21 22:05:22 -07:00
|
|
|
|
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)
|
2014-12-21 22:05:22 -07:00
|
|
|
end)
|