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