1" Test for textobjects
2
3if !has('textobjects')
4  finish
5endif
6
7set belloff=all
8func 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!
32endfunc
33
34func Test_inner_block_without_cpo_M()
35  call CpoM('(red \(blue) green)', 0, ['red \(blue', 'red \(blue', ''])
36endfunc
37
38func Test_inner_block_with_cpo_M_left_backslash()
39  call CpoM('(red \(blue) green)', 1, ['red \(blue) green', 'blue', 'red \(blue) green'])
40endfunc
41
42func Test_inner_block_with_cpo_M_right_backslash()
43  call CpoM('(red (blue\) green)', 1, ['red (blue\) green', 'blue\', 'red (blue\) green'])
44endfunc
45
46func Test_quote_selection_selection_exclusive()
47  new
48  call setline(1, "a 'bcde' f")
49  set selection=exclusive
50  exe "norm! fdvhi'y"
51  call assert_equal('bcde', @")
52  set selection&vim
53  bw!
54endfunc
55