robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f907614088
master
1local n =require ( 'test.functional.testnvim' )() 2local t =require ( 'test.testutil' ) 3local Screen =require ( 'test.functional.ui.screen' ) 4 5local describe , it , before_each =t . describe , t . it , t . before_each 6local clear =n . clear 7local exec =n . exec 8local feed =n . feed 9 10before_each ( clear ) 11 12describe ( 'matchaddpos()' , function () 13-- oldtest: Test_matchaddpos_dump() 14it ( 'can add more than 8 match positions vim-patch:9.0.0620' , function () 15local screen =Screen . new ( 60 , 14 ) 16exec ( [[ 17call setline(1, ['1234567890123']->repeat(14)) 18call matchaddpos('Search', range(1, 12)->map({i, v -> [v, v]})) 19]] ) 20screen : expect ( [[ 21{10:^1}234567890123 | 221{10:2}34567890123 | 2312{10:3}4567890123 | 24123{10:4}567890123 | 251234{10:5}67890123 | 2612345{10:6}7890123 | 27123456{10:7}890123 | 281234567{10:8}90123 | 2912345678{10:9}0123 | 30123456789{10:0}123 | 311234567890{10:1}23 | 3212345678901{10:2}3 | 331234567890123 | 34| 35]] ) 36end ) 37end ) 38 39describe ( 'match highlighting' , function () 40-- oldtest: Test_match_in_linebreak() 41it ( 'does not continue in linebreak vim-patch:8.2.3698' , function () 42local screen =Screen . new ( 75 , 10 ) 43exec ( [=[ 44set breakindent linebreak breakat+=] 45call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1) 46call matchaddpos('ErrorMsg', [[1, 51]]) 47]=] ) 48screen : expect ( [[ 49^xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx{9:]} | 50xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | 51{1:~ }|*7 52| 53]] ) 54end ) 55 56it ( 'is shown with incsearch vim-patch:8.2.3940' , function () 57local screen =Screen . new ( 75 , 6 ) 58exec ( [[ 59set incsearch 60call setline(1, range(20)) 61call matchaddpos('ErrorMsg', [3]) 62]] ) 63screen : expect ( [[ 64^0 | 651 | 66{9:2} | 673 | 684 | 69| 70]] ) 71feed ( ':s/0' ) 72screen : expect ( [[ 73{10:0} | 741 | 75{9:2} | 763 | 774 | 78:s/0^ | 79]] ) 80end ) 81 82it ( 'on a Tab vim-patch:8.2.4062' , function () 83local screen =Screen . new ( 75 , 10 ) 84exec ( [[ 85set linebreak 86call setline(1, "\tix") 87call matchadd('ErrorMsg', '\t') 88]] ) 89screen : expect ( [[ 90{9: ^ }ix | 91{1:~ }|*8 92| 93]] ) 94end ) 95end )