Mercurial > vim
annotate src/testdir/test_textobjects.vim @ 11845:4be4a033c246
Added tag v8.0.0802 for changeset 42585fee5e668becc17c4ebd780fe0e15489591e
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 29 Jul 2017 16:15:04 +0200 |
parents | 29a781fd3f27 |
children | 44aa2997239d |
rev | line source |
---|---|
9642
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test for textobjects |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 if !has('textobjects') |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 finish |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 endif |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
11091
ae45d497868f
patch 8.0.0433: beeps when running tests
Christian Brabandt <cb@256bit.org>
parents:
9642
diff
changeset
|
7 set belloff=all |
11478
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
8 func CpoM(line, useM, expected) |
9642
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 new |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 if a:useM |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 set cpoptions+=M |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 else |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 set cpoptions-=M |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 endif |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 call setline(1, a:line) |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 call setreg('"', '') |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 normal! ggfrmavi)y |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 call assert_equal(getreg('"'), a:expected[0]) |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call setreg('"', '') |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 normal! `afbmavi)y |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 call assert_equal(getreg('"'), a:expected[1]) |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 call setreg('"', '') |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 normal! `afgmavi)y |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 call assert_equal(getreg('"'), a:expected[2]) |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 |
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 q! |
11478
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
32 endfunc |
9642
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 |
11478
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
34 func Test_inner_block_without_cpo_M() |
9642
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 call CpoM('(red \(blue) green)', 0, ['red \(blue', 'red \(blue', '']) |
11478
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
36 endfunc |
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
37 |
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
38 func Test_inner_block_with_cpo_M_left_backslash() |
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
39 call CpoM('(red \(blue) green)', 1, ['red \(blue) green', 'blue', 'red \(blue) green']) |
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
40 endfunc |
9642
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 |
11478
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
42 func Test_inner_block_with_cpo_M_right_backslash() |
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
43 call CpoM('(red (blue\) green)', 1, ['red (blue\) green', 'blue\', 'red (blue\) green']) |
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
44 endfunc |
9642
8cc4dfadfd48
commit https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 |
11478
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
46 func Test_quote_selection_selection_exclusive() |
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
47 new |
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
48 call setline(1, "a 'bcde' f") |
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
49 set selection=exclusive |
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
50 exe "norm! fdvhi'y" |
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
51 call assert_equal('bcde', @") |
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
52 set selection&vim |
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
53 bw! |
29a781fd3f27
patch 8.0.0622: selecting quoted text fails with 'selection' "exclusive"
Christian Brabandt <cb@256bit.org>
parents:
11091
diff
changeset
|
54 endfunc |