blob: 5e67f25286bc202d4f42160d15cb64850b7f5ba5 [file] [log] [blame]
Bram Moolenaar00b24be2016-07-23 22:04:47 +02001" Test for textobjects
2
3if !has('textobjects')
4 finish
5endif
6
Bram Moolenaarc3c766e2017-03-08 22:55:19 +01007set belloff=all
Bram Moolenaar00b24be2016-07-23 22:04:47 +02008function! CpoM(line, useM, expected)
9 new
10
11 if a:useM
12 set cpoptions+=M
13 else
14 set cpoptions-=M
15 endif
16
17 call setline(1, a:line)
18
19 call setreg('"', '')
20 normal! ggfrmavi)y
21 call assert_equal(getreg('"'), a:expected[0])
22
23 call setreg('"', '')
24 normal! `afbmavi)y
25 call assert_equal(getreg('"'), a:expected[1])
26
27 call setreg('"', '')
28 normal! `afgmavi)y
29 call assert_equal(getreg('"'), a:expected[2])
30
31 q!
32endfunction
33
34function! Test_inner_block_without_cpo_M()
35 call CpoM('(red \(blue) green)', 0, ['red \(blue', 'red \(blue', ''])
36endfunction
37
38function! Test_inner_block_with_cpo_M_left_backslash()
39 call CpoM('(red \(blue) green)', 1, ['red \(blue) green', 'blue', 'red \(blue) green'])
40endfunction
41
42function! Test_inner_block_with_cpo_M_right_backslash()
43 call CpoM('(red (blue\) green)', 1, ['red (blue\) green', 'blue\', 'red (blue\) green'])
44endfunction