blob: dc48efc67ac3b959b26d5d492db8b4f18f588342 [file] [log] [blame]
Bram Moolenaar438b64a2015-03-13 15:03:00 +01001Tests for text-objects vim: set ft=vim :
2
3STARTTEST
4:so small.vim
5:if !has('textobjects') | e! test.ok | wq! test.out | endif
Bram Moolenaar29d54df2015-04-13 12:58:12 +02006:set nocp viminfo+=nviminfo
Bram Moolenaar438b64a2015-03-13 15:03:00 +01007:"
8:function SelectionOut(data)
9: new
10: call setline(1, a:data)
11: call setreg('"', '')
12: normal! ggfrmavi)y
13: $put =getreg('\"')
14: call setreg('"', '')
15: normal! `afbmavi)y
16: $put =getreg('\"')
17: call setreg('"', '')
18: normal! `afgmavi)y
19: $put =getreg('\"')
20: %yank a
21: q!
22: $put =getreg('a')
23:endfunction
24:"
25:$put ='# Test for vi) without cpo-M'
26:set cpo-=M
27:call SelectionOut('(red \(blue) green)')
28:"
29:$put ='# Test for vi) with cpo-M #1'
30:set cpo+=M
31:call SelectionOut('(red \(blue) green)')
32:"
33:$put ='# Test for vi) with cpo-M #2'
34:set cpo+=M
35:call SelectionOut('(red (blue\) green)')
36:/^Results/,$w test.out
37:qa!
38ENDTEST
39
40Results of text-objects