Mercurial > vim
annotate src/testdir/test80.in @ 9921:adef2643c576 v7.4.2234
commit https://github.com/vim/vim/commit/dd1248143e56b1450903fe40813e40c63691b071
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 21 15:00:03 2016 +0200
patch 7.4.2234
Problem: Can't build with +eval but without +quickfix. (John Marriott)
Solution: Move skip_vimgrep_pat() to separate #ifdef block.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 21 Aug 2016 15:15:05 +0200 |
parents | 219dbe63ad2a |
children |
rev | line source |
---|---|
9719
219dbe63ad2a
commit https://github.com/vim/vim/commit/89eaa4185efacab253b23a182c1c8a7bbf1096c9
Christian Brabandt <cb@256bit.org>
parents:
5794
diff
changeset
|
1 Test for *sub-replace-special* and *sub-replace-expression* on substitute(). |
219dbe63ad2a
commit https://github.com/vim/vim/commit/89eaa4185efacab253b23a182c1c8a7bbf1096c9
Christian Brabandt <cb@256bit.org>
parents:
5794
diff
changeset
|
2 Test for submatch() on substitute(). |
2904 | 3 Test for *:s%* on :substitute. |
4 | |
5 STARTTEST | |
6 :so small.vim | |
7 ENDTEST | |
8 | |
9 TEST_1: | |
10 | |
11 STARTTEST | |
12 :set magic | |
13 :set cpo& | |
14 :$put =\"\n\nTEST_1:\" | |
15 :$put =substitute('A', 'A', '&&', '') | |
16 :$put =substitute('B', 'B', '\&', '') | |
17 :$put =substitute('C123456789', 'C\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\0\9\8\7\6\5\4\3\2\1', '') | |
18 :$put =substitute('D', 'D', 'd', '') | |
19 :$put =substitute('E', 'E', '~', '') | |
20 :$put =substitute('F', 'F', '\~', '') | |
21 :$put =substitute('G', 'G', '\ugg', '') | |
22 :$put =substitute('H', 'H', '\Uh\Eh', '') | |
23 :$put =substitute('I', 'I', '\lII', '') | |
24 :$put =substitute('J', 'J', '\LJ\EJ', '') | |
25 :$put =substitute('K', 'K', '\Uk\ek', '') | |
26 :$put =substitute('lLl', 'L', ' ', '') | |
27 :$put =substitute('mMm', 'M', '\r', '') | |
28 :$put =substitute('nNn', 'N', '\ ', '') | |
29 :$put =substitute('oOo', 'O', '\n', '') | |
30 :$put =substitute('pPp', 'P', '\b', '') | |
31 :$put =substitute('qQq', 'Q', '\t', '') | |
32 :$put =substitute('rRr', 'R', '\\', '') | |
33 :$put =substitute('sSs', 'S', '\c', '') | |
34 :$put =substitute('uUu', 'U', \"\n\", '') | |
35 :$put =substitute('vVv', 'V', \"\b\", '') | |
36 :$put =substitute('wWw', 'W', \"\\\", '') | |
37 :$put =substitute('xXx', 'X', \"\r\", '') | |
4244 | 38 :$put =substitute('Y', 'Y', '\L\uyYy\l\EY', '') |
39 :$put =substitute('Z', 'Z', '\U\lZzZ\u\Ez', '') | |
2904 | 40 /^TEST_2 |
41 ENDTEST | |
42 | |
43 TEST_2: | |
44 | |
45 STARTTEST | |
46 :set nomagic | |
47 :set cpo& | |
48 :$put =\"\n\nTEST_2:\" | |
49 :$put =substitute('A', 'A', '&&', '') | |
50 :$put =substitute('B', 'B', '\&', '') | |
51 :$put =substitute('C123456789', 'C\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\0\9\8\7\6\5\4\3\2\1', '') | |
52 :$put =substitute('D', 'D', 'd', '') | |
53 :$put =substitute('E', 'E', '~', '') | |
54 :$put =substitute('F', 'F', '\~', '') | |
55 :$put =substitute('G', 'G', '\ugg', '') | |
56 :$put =substitute('H', 'H', '\Uh\Eh', '') | |
57 :$put =substitute('I', 'I', '\lII', '') | |
58 :$put =substitute('J', 'J', '\LJ\EJ', '') | |
59 :$put =substitute('K', 'K', '\Uk\ek', '') | |
60 :$put =substitute('lLl', 'L', ' ', '') | |
61 :$put =substitute('mMm', 'M', '\r', '') | |
62 :$put =substitute('nNn', 'N', '\ ', '') | |
63 :$put =substitute('oOo', 'O', '\n', '') | |
64 :$put =substitute('pPp', 'P', '\b', '') | |
65 :$put =substitute('qQq', 'Q', '\t', '') | |
66 :$put =substitute('rRr', 'R', '\\', '') | |
67 :$put =substitute('sSs', 'S', '\c', '') | |
68 :$put =substitute('tTt', 'T', \"\r\", '') | |
69 :$put =substitute('uUu', 'U', \"\n\", '') | |
70 :$put =substitute('vVv', 'V', \"\b\", '') | |
71 :$put =substitute('wWw', 'W', \"\\\", '') | |
4244 | 72 :$put =substitute('X', 'X', '\L\uxXx\l\EX', '') |
73 :$put =substitute('Y', 'Y', '\U\lYyY\u\Ey', '') | |
2904 | 74 /^TEST_3 |
75 ENDTEST | |
76 | |
77 TEST_3: | |
78 | |
79 STARTTEST | |
80 :set magic& | |
81 :set cpo& | |
82 :$put =\"\n\nTEST_3:\" | |
83 :let y = substitute('aAa', 'A', '\="\\"', '') | $put =y | |
84 :let y = substitute('bBb', 'B', '\="\\\\"', '') | $put =y | |
85 :let y = substitute('cCc', 'C', '\=" "', '') | $put =y | |
86 :let y = substitute('dDd', 'D', '\="\\ "', '') | $put =y | |
87 :let y = substitute('eEe', 'E', '\="\\\\ "', '') | $put =y | |
88 :let y = substitute('fFf', 'F', '\="\\r"', '') | $put =y | |
89 :let y = substitute('jJj', 'J', '\="\\n"', '') | $put =y | |
90 :let y = substitute('kKk', 'K', '\="\r"', '') | $put =y | |
91 :let y = substitute('lLl', 'L', '\="\n"', '') | $put =y | |
92 /^TEST_4 | |
93 ENDTEST | |
94 | |
95 TEST_4: | |
96 | |
97 STARTTEST | |
98 :set magic& | |
99 :set cpo& | |
100 :$put =\"\n\nTEST_4:\" | |
101 :let y = substitute('aAa', 'A', '\=substitute(submatch(0), ".", "\\", "")', '') | $put =y | |
102 :let y = substitute('bBb', 'B', '\=substitute(submatch(0), ".", "\\\\", "")', '') | $put =y | |
103 :let y = substitute('cCc', 'C', '\=substitute(submatch(0), ".", " ", "")', '') | $put =y | |
104 :let y = substitute('dDd', 'D', '\=substitute(submatch(0), ".", "\\ ", "")', '') | $put =y | |
105 :let y = substitute('eEe', 'E', '\=substitute(submatch(0), ".", "\\\\ ", "")', '') | $put =y | |
106 :let y = substitute('fFf', 'F', '\=substitute(submatch(0), ".", "\\r", "")', '') | $put =y | |
107 :let y = substitute('jJj', 'J', '\=substitute(submatch(0), ".", "\\n", "")', '') | $put =y | |
108 :let y = substitute('kKk', 'K', '\=substitute(submatch(0), ".", "\r", "")', '') | $put =y | |
109 :let y = substitute('lLl', 'L', '\=substitute(submatch(0), ".", "\n", "")', '') | $put =y | |
110 /^TEST_5 | |
111 ENDTEST | |
112 | |
113 TEST_5: | |
114 | |
115 STARTTEST | |
116 :set magic& | |
117 :set cpo& | |
118 :$put =\"\n\nTEST_5:\" | |
119 :$put =substitute('A123456789', 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\=submatch(0) . submatch(9) . submatch(8) . submatch(7) . submatch(6) . submatch(5) . submatch(4) . submatch(3) . submatch(2) . submatch(1)', '') | |
5794 | 120 :$put =substitute('A123456789', 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\=string([submatch(0, 1), submatch(9, 1), submatch(8, 1), submatch(7, 1), submatch(6, 1), submatch(5, 1), submatch(4, 1), submatch(3, 1), submatch(2, 1), submatch(1, 1)])', '') |
2904 | 121 /^TEST_6 |
122 ENDTEST | |
123 | |
124 TEST_6: | |
125 | |
126 STARTTEST | |
127 :set magic& | |
128 :$put =\"\n\nTEST_6:\" | |
129 :set cpo+=/ | |
130 :$put =substitute('A', 'A', 'a', '') | |
131 :$put =substitute('B', 'B', '%', '') | |
132 :set cpo-=/ | |
133 :$put =substitute('C', 'C', 'c', '') | |
134 :$put =substitute('D', 'D', '%', '') | |
135 /^TEST_7 | |
136 ENDTEST | |
137 | |
138 TEST_7: | |
139 | |
140 STARTTEST | |
141 :set magic& | |
142 :set cpo& | |
143 :$put =\"\n\nTEST_7:\" | |
144 :$put =substitute('A A', 'A.', '\=submatch(0)', '') | |
145 :$put =substitute(\"B\nB\", 'B.', '\=submatch(0)', '') | |
5794 | 146 :$put =substitute(\"B\nB\", 'B.', '\=string(submatch(0, 1))', '') |
5388 | 147 :$put =substitute('-bb', '\zeb', 'a', 'g') |
148 :$put =substitute('-bb', '\ze', 'c', 'g') | |
2904 | 149 /^TEST_8 |
150 ENDTEST | |
151 | |
152 TEST_8: | |
153 | |
154 STARTTEST | |
4078 | 155 :set magic& |
156 :set cpo& | |
157 :$put =\"\n\nTEST_8:\" | |
158 :$put =',,X' | |
159 :s/\(^\|,\)\ze\(,\|X\)/\1N/g | |
160 :$put =',,Y' | |
161 :s/\(^\|,\)\ze\(,\|Y\)/\1N/gc | |
162 a:$put =',,Z' | |
163 :s/\(^\|,\)\ze\(,\|Z\)/\1N/gc | |
4099 | 164 yy/^TEST_9: |
4078 | 165 ENDTEST |
166 | |
167 TEST_9: | |
168 | |
169 STARTTEST | |
4099 | 170 :set magic& |
171 :set cpo& | |
172 :$put =\"\n\nTEST_9:\" | |
173 :$put ='xxx' | |
174 :s/x/X/gc | |
175 yyq/^TEST_10: | |
176 ENDTEST | |
177 | |
178 TEST_10: | |
179 | |
180 STARTTEST | |
5623 | 181 :set magic& |
182 :set cpo& | |
183 :$put =\"\n\nTEST_10:\" | |
184 :let y = substitute('123', '\zs', 'a', 'g') | $put =y | |
185 :let y = substitute('123', '\zs.', 'a', 'g') | $put =y | |
186 :let y = substitute('123', '.\zs', 'a', 'g') | $put =y | |
187 :let y = substitute('123', '\ze', 'a', 'g') | $put =y | |
188 :let y = substitute('123', '\ze.', 'a', 'g') | $put =y | |
189 :let y = substitute('123', '.\ze', 'a', 'g') | $put =y | |
190 :let y = substitute('123', '1\|\ze', 'a', 'g') | $put =y | |
191 :let y = substitute('123', '1\zs\|[23]', 'a', 'g') | $put =y | |
192 /^TEST_11 | |
193 ENDTEST | |
194 | |
195 TEST_11: | |
196 | |
197 STARTTEST | |
2904 | 198 :/^Results/,$wq! test.out |
199 ENDTEST | |
200 | |
201 Results of test72: |