blob: 2148b2183216e0b5479cd26d02a0d2471c3e95ee (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
if helpers.pending_win32(pending) then return end
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()
local tmp_path = helpers.funcs.tempname()
command('let g:test = "foo"')
command('autocmd! TabNew ' .. tmp_path .. ' let g:test = "bar"')
command('tabnew ' .. tmp_path ..'X')
eq('foo', eval('g:test'))
command('tabnew ' .. tmp_path)
eq('bar', eval('g:test'))
end)
end)
|