robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f907614088
master
1local t =require ( 'test.testutil' ) 2local n =require ( 'test.functional.testnvim' )() 3 4local describe , it , before_each =t . describe , t . it , t . before_each 5local clear =n . clear 6local command =n . command 7local eq =t . eq 8local eval =n . eval 9 10describe ( 'autocmd TabNew' , function () 11before_each ( clear ) 12 13it ( 'matches when opening any new tab' , function () 14command ( 'autocmd! TabNew * let g:test = "tabnew:".tabpagenr().":".bufnr("")' ) 15command ( 'tabnew' ) 16eq ( 'tabnew:2:1' , eval ( 'g:test' )) 17command ( 'tabnew test.x' ) 18eq ( 'tabnew:3:2' , eval ( 'g:test' )) 19end ) 20 21it ( 'matches when opening a new tab for FILE' , function () 22command ( 'let g:test = "foo"' ) 23command ( 'autocmd! TabNew Xtest-tabnew let g:test = "bar"' ) 24command ( 'tabnew Xtest-tabnewX' ) 25eq ( 'foo' , eval ( 'g:test' )) 26command ( 'tabnew Xtest-tabnew' ) 27eq ( 'bar' , eval ( 'g:test' )) 28end ) 29end )