robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
aa1d8a2702
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 feed =n . feed 9local fn =n . fn 10local pcall_err =t . pcall_err 11 12describe ( 'search (/)' , function () 13before_each ( clear ) 14 15it ( 'fails with huge column (%c) value #9930' , function () 16eq ( [[Vim:E951: \% value too large]] , pcall_err ( command , '/\\v%18446744071562067968c' )) 17eq ( [[Vim:E951: \% value too large]] , pcall_err ( command , '/\\v%2147483648c' )) 18end ) 19 20it ( 'operator + gn does not modify the Visual marks #40949' , function () 21fn . setline ( 1 , { 'a b foo bar' , 'x y zub foo' , 'foo' } ) 22feed ( 'ggVj<Esc>' ) -- Select lines 1-2. 23local vstart , vend =fn . getpos ( "'<" ), fn . getpos ( "'>" ) 24feed ( [[/\%Vfoo<CR>]] ) 25feed ( 'ggcgnX<Esc>' ) 26eq ( { vstart , vend , 'V' } , { fn . getpos ( "'<" ), fn . getpos ( "'>" ), fn . visualmode () } ) 27-- "\%V" still means the selection: "." changes the next match in it, not the one on line 3. 28feed ( '.' ) 29eq ( { 'a b X bar' , 'x y zub X' , 'foo' } , fn . getline ( 1 , '$' )) 30-- Same for a forced-blockwise motion. 31feed ( 'ggd<C-v>j' ) 32eq ( { vstart , vend , 'V' } , { fn . getpos ( "'<" ), fn . getpos ( "'>" ), fn . visualmode () } ) 33-- Same for an omap that starts Visual mode (custom textobj). 34command ( 'onoremap <silent> F :<C-U>normal! 0viw<CR>' ) 35feed ( 'GyF' ) 36eq ( 'foo' , fn . getreg ( '"' )) 37eq ( { vstart , vend , 'V' } , { fn . getpos ( "'<" ), fn . getpos ( "'>" ), fn . visualmode () } ) 38end ) 39end )