robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f907614088
master
1-- Some tests for buffer-local autocommands 2 3local n =require ( 'test.functional.testnvim' )() 4local t =require ( 'test.testutil' ) 5 6local describe , it , setup , teardown =t . describe , t . it , t . setup , t . teardown 7local clear =n . clear 8local expect =n . expect 9local command =n . command 10 11local fname ='Xtest-functional-legacy-054' 12 13describe ( 'BufLeave <buffer>' , function () 14setup ( clear ) 15 16it ( 'is working' , function () 17command ( 'write! ' .. fname ) 18command ( 'autocmd BufLeave <buffer> normal! Ibuffer-local autocommand' ) 19command ( 'autocmd BufLeave <buffer> update' ) 20 21-- Here, autocommand for xx shall append a line 22-- But autocommand shall not apply to buffer named <buffer> 23command ( 'edit somefile' ) 24 25-- Here, autocommand shall be auto-deleted 26command ( 'bwipeout ' .. fname ) 27 28-- Nothing shall be written 29command ( 'edit ' .. fname ) 30command ( 'edit somefile' ) 31command ( 'edit ' .. fname ) 32 33expect ( 'buffer-local autocommand' ) 34end ) 35 36teardown ( function () 37os . remove ( fname ) 38end ) 39end )