Mercurial > vim
annotate src/testdir/test_textobjects.vim @ 12560:44aa2997239d v8.0.1158
patch 8.0.1158: still old style tests
commit https://github.com/vim/vim/commit/db51007108a6ab0671e7f7b4844557cbe647185f
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 28 21:52:17 2017 +0200
patch 8.0.1158: still old style tests
Problem: Still old style tests.
Solution: Convert serveral tests to new style. (Yegappan Lakshmanan)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 28 Sep 2017 22:00:05 +0200 |
parents | 29a781fd3f27 |
children | 1fad9675d8fd |
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 |
12560
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
55 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
56 " Tests for string and html text objects |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
57 func Test_string_html_objects() |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
58 enew! |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
59 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
60 let t = '"wo\"rd\\" foo' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
61 put =t |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
62 normal! da" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
63 call assert_equal('foo', getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
64 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
65 let t = "'foo' 'bar' 'piep'" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
66 put =t |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
67 normal! 0va'a'rx |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
68 call assert_equal("xxxxxxxxxxxx'piep'", getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
69 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
70 let t = "bla bla `quote` blah" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
71 put =t |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
72 normal! 02f`da` |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
73 call assert_equal("bla bla blah", getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
74 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
75 let t = 'out " in "noXno"' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
76 put =t |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
77 normal! 0fXdi" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
78 call assert_equal('out " in ""', getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
79 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
80 let t = "\"'\" 'blah' rep 'buh'" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
81 put =t |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
82 normal! 03f'vi'ry |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
83 call assert_equal("\"'\" 'blah'yyyyy'buh'", getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
84 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
85 set quoteescape=+*- |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
86 let t = "bla `s*`d-`+++`l**` b`la" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
87 put =t |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
88 normal! di` |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
89 call assert_equal("bla `` b`la", getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
90 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
91 let t = 'voo "nah" sdf " asdf" sdf " sdf" sd' |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
92 put =t |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
93 normal! $F"va"oha"i"rz |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
94 call assert_equal('voo "zzzzzzzzzzzzzzzzzzzzzzzzzzzzsd', getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
95 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
96 let t = "-<b>asdf<i>Xasdf</i>asdf</b>-" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
97 put =t |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
98 normal! fXdit |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
99 call assert_equal('-<b>asdf<i></i>asdf</b>-', getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
100 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
101 let t = "-<b>asdX<i>a<i />sdf</i>asdf</b>-" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
102 put =t |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
103 normal! 0fXdit |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
104 call assert_equal('-<b></b>-', getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
105 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
106 let t = "-<b>asdf<i>Xasdf</i>asdf</b>-" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
107 put =t |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
108 normal! fXdat |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
109 call assert_equal('-<b>asdfasdf</b>-', getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
110 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
111 let t = "-<b>asdX<i>as<b />df</i>asdf</b>-" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
112 put =t |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
113 normal! 0fXdat |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
114 call assert_equal('--', getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
115 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
116 let t = "-<b>\ninnertext object\n</b>" |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
117 put =t |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
118 normal! dit |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
119 call assert_equal('-<b></b>', getline('.')) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
120 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
121 set quoteescape& |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
122 enew! |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
123 endfunc |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
124 |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
125 " Tests for match() and matchstr() |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
126 func Test_match() |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
127 call assert_equal("b", matchstr("abcd", ".", 0, 2)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
128 call assert_equal("bc", matchstr("abcd", "..", 0, 2)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
129 call assert_equal("c", matchstr("abcd", ".", 2, 0)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
130 call assert_equal("a", matchstr("abcd", ".", 0, -1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
131 call assert_equal(-1, match("abcd", ".", 0, 5)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
132 call assert_equal(0 , match("abcd", ".", 0, -1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
133 call assert_equal(0 , match('abc', '.', 0, 1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
134 call assert_equal(1 , match('abc', '.', 0, 2)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
135 call assert_equal(2 , match('abc', '.', 0, 3)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
136 call assert_equal(-1, match('abc', '.', 0, 4)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
137 call assert_equal(1 , match('abc', '.', 1, 1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
138 call assert_equal(2 , match('abc', '.', 2, 1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
139 call assert_equal(-1, match('abc', '.', 3, 1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
140 call assert_equal(3 , match('abc', '$', 0, 1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
141 call assert_equal(-1, match('abc', '$', 0, 2)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
142 call assert_equal(3 , match('abc', '$', 1, 1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
143 call assert_equal(3 , match('abc', '$', 2, 1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
144 call assert_equal(3 , match('abc', '$', 3, 1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
145 call assert_equal(-1, match('abc', '$', 4, 1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
146 call assert_equal(0 , match('abc', '\zs', 0, 1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
147 call assert_equal(1 , match('abc', '\zs', 0, 2)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
148 call assert_equal(2 , match('abc', '\zs', 0, 3)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
149 call assert_equal(3 , match('abc', '\zs', 0, 4)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
150 call assert_equal(-1, match('abc', '\zs', 0, 5)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
151 call assert_equal(1 , match('abc', '\zs', 1, 1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
152 call assert_equal(2 , match('abc', '\zs', 2, 1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
153 call assert_equal(3 , match('abc', '\zs', 3, 1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
154 call assert_equal(-1, match('abc', '\zs', 4, 1)) |
44aa2997239d
patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents:
11478
diff
changeset
|
155 endfunc |