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 exec_lua =n . exec_lua 7local eq =t . eq 8local pcall_err =t . pcall_err 9 10describe ( 'vim.spell' , function () 11before_each ( function () 12clear () 13end ) 14 15describe ( '.check' , function () 16local check =function ( x , exp ) 17return eq ( exp , exec_lua ( 'return vim.spell.check(...)' , x )) 18end 19 20it ( 'can handle nil' , function () 21eq ( 22[[bad argument #1 to 'check' (expected string)]] , 23pcall_err ( exec_lua , [[vim.spell.check(nil)]] ) 24) 25end ) 26 27it ( 'can check spellings' , function () 28check ( 'hello' , {} ) 29 30check ( 'helloi' , { { 'helloi' , 'bad' , 1 } } ) 31 32check ( 'hello therei' , { { 'therei' , 'bad' , 7 } } ) 33 34check ( 'hello. there' , { { 'there' , 'caps' , 8 } } ) 35 36check ( 'neovim cna chkc spellins. okay?' , { 37{ 'neovim' , 'bad' , 1 } , 38{ 'cna' , 'bad' , 8 } , 39{ 'chkc' , 'bad' , 12 } , 40{ 'spellins' , 'bad' , 17 } , 41{ 'okay' , 'caps' , 27 } , 42} ) 43end ) 44end ) 45end )