1 2function! Test_charsearch() 3 enew! 4 call append(0, ['Xabcdefghijkemnopqretuvwxyz', 5 \ 'Yabcdefghijkemnopqretuvwxyz', 6 \ 'Zabcdefghijkemnokqretkvwxyz']) 7 " check that "fe" and ";" work 8 1 9 normal! ylfep;;p,,p 10 call assert_equal('XabcdeXfghijkeXmnopqreXtuvwxyz', getline(1)) 11 " check that save/restore works 12 2 13 normal! ylfep 14 let csave = getcharsearch() 15 normal! fip 16 call setcharsearch(csave) 17 normal! ;p;p 18 call assert_equal('YabcdeYfghiYjkeYmnopqreYtuvwxyz', getline(2)) 19 20 " check that setcharsearch() changes the settings. 21 3 22 normal! ylfep 23 call setcharsearch({'char': 'k'}) 24 normal! ;p 25 call setcharsearch({'forward': 0}) 26 normal! $;p 27 call setcharsearch({'until': 1}) 28 set cpo-=; 29 normal! ;;p 30 call assert_equal('ZabcdeZfghijkZZemnokqretkZvwxyz', getline(3)) 31 enew! 32endfunction 33 34" Test for t,f,F,T movement commands and 'cpo-;' setting 35function! Test_search_cmds() 36 enew! 37 call append(0, ["aaa two three four", " zzz", "yyy ", 38 \ "bbb yee yoo four", "ccc two three four", 39 \ "ddd yee yoo four"]) 40 set cpo-=; 41 1 42 normal! 0tt;D 43 2 44 normal! 0fz;D 45 3 46 normal! $Fy;D 47 4 48 normal! $Ty;D 49 set cpo+=; 50 5 51 normal! 0tt;;D 52 6 53 normal! $Ty;;D 54 55 call assert_equal('aaa two', getline(1)) 56 call assert_equal(' z', getline(2)) 57 call assert_equal('y', getline(3)) 58 call assert_equal('bbb y', getline(4)) 59 call assert_equal('ccc', getline(5)) 60 call assert_equal('ddd yee y', getline(6)) 61 enew! 62endfunction 63