File: tabnew_spec.lua

package info (click to toggle)
neovim 0.11.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 64,140 kB
  • sloc: ansic: 263,427; python: 1,472; lisp: 1,237; sh: 1,138; makefile: 382; xml: 84; ruby: 6
file content (28 lines) | stat: -rw-r--r-- 795 bytes parent folder | download | duplicates (3)
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
local t = require('test.testutil')
local n = require('test.functional.testnvim')()

local clear = n.clear
local command = n.command
local eq = t.eq
local eval = n.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"')
    command('autocmd! TabNew Xtest-tabnew let g:test = "bar"')
    command('tabnew Xtest-tabnewX')
    eq('foo', eval('g:test'))
    command('tabnew Xtest-tabnew')
    eq('bar', eval('g:test'))
  end)
end)