mirror of
https://github.com/neovim/neovim.git
synced 2025-10-19 00:01:54 +00:00

Problem: Text object tests are old style.
Solution: Turn them into new style tests. (James McCoy, closes vim/vim#941)
00b24be454
44 lines
946 B
VimL
44 lines
946 B
VimL
" Test for textobjects
|
|
|
|
if !has('textobjects')
|
|
finish
|
|
endif
|
|
|
|
function! CpoM(line, useM, expected)
|
|
new
|
|
|
|
if a:useM
|
|
set cpoptions+=M
|
|
else
|
|
set cpoptions-=M
|
|
endif
|
|
|
|
call setline(1, a:line)
|
|
|
|
call setreg('"', '')
|
|
normal! ggfrmavi)y
|
|
call assert_equal(getreg('"'), a:expected[0])
|
|
|
|
call setreg('"', '')
|
|
normal! `afbmavi)y
|
|
call assert_equal(getreg('"'), a:expected[1])
|
|
|
|
call setreg('"', '')
|
|
normal! `afgmavi)y
|
|
call assert_equal(getreg('"'), a:expected[2])
|
|
|
|
q!
|
|
endfunction
|
|
|
|
function! Test_inner_block_without_cpo_M()
|
|
call CpoM('(red \(blue) green)', 0, ['red \(blue', 'red \(blue', ''])
|
|
endfunction
|
|
|
|
function! Test_inner_block_with_cpo_M_left_backslash()
|
|
call CpoM('(red \(blue) green)', 1, ['red \(blue) green', 'blue', 'red \(blue) green'])
|
|
endfunction
|
|
|
|
function! Test_inner_block_with_cpo_M_right_backslash()
|
|
call CpoM('(red (blue\) green)', 1, ['red (blue\) green', 'blue\', 'red (blue\) green'])
|
|
endfunction
|