robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f907614088
master
1-- vim: set foldmethod=marker foldmarker=[[,]] : 2-- Tests for multi-line regexps with ":s" 3 4local n =require ( 'test.functional.testnvim' )() 5local t =require ( 'test.testutil' ) 6 7local describe , it , setup =t . describe , t . it , t . setup 8local clear , feed , insert =n . clear , n . feed , n . insert 9local expect =n . expect 10 11describe ( 'multi-line regexp' , function () 12setup ( clear ) 13 14it ( 'is working' , function () 15insert ( [[ 161 aa 17bb 18cc 192 dd 20ee 213 ef 22gh 234 ij 245 a8 258b c9 269d 276 e7 2877f 29xxxxx]] ) 30 31-- Test if replacing a line break works with a back reference 32feed ( [[:/^1/,/^2/s/\n\(.\)/ \1/<cr>]] ) 33 34-- Test if inserting a line break works with a back reference 35feed ( [[:/^3/,/^4/s/\(.\)$/\r\1/<cr>]] ) 36 37-- Test if replacing a line break with another line break works 38feed ( [[:/^5/,/^6/s/\(\_d\{3}\)/x\1x/<cr>]] ) 39 40expect ( [[ 411 aa bb cc 2 dd ee 423 e 43f 44g 45h 464 i 47j 485 ax8 498xb cx9 509xd 516 ex7 527x7f 53xxxxx]] ) 54end ) 55end )