Mercurial > vim
annotate src/testdir/test94.in @ 8785:1cb59cd2d382 v7.4.1681
commit https://github.com/vim/vim/commit/ef9d9b94a8803c405884bb6914ed745ede57c596
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Mar 28 22:44:50 2016 +0200
patch 7.4.1681
Problem: Coverity warns for fixed size buffer length (false positive).
Solution: Add a check for the name length.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 28 Mar 2016 22:45:08 +0200 |
parents | a69b5e4beefd |
children | ae45d497868f |
rev | line source |
---|---|
4274 | 1 Test for Visual mode and operators |
2 | |
3 Tests for the two kinds of operations: Those executed with Visual mode | |
4 followed by an operator and those executed via Operator-pending mode. Also | |
5 part of the test are mappings, counts, and repetition with the . command. | |
6 | |
7 Test cases: | |
8 - Visual modes (v V CTRL-V) followed by an operator; count; repeating | |
9 - Visual mode maps; count; repeating | |
10 - Simple | |
11 - With an Ex command (custom text object) | |
12 - Operator-pending mode maps | |
13 - Simple | |
14 - With Ex command moving the cursor | |
15 - With Ex command and Visual selection (custom text object) | |
16 - Patch 7.3.879: Properly abort Ex command in Operator-pending mode | |
17 | |
18 STARTTEST | |
19 :so small.vim | |
7246
a69b5e4beefd
commit https://github.com/vim/vim/commit/cfcd1ddd103129b309671cba5cff55e19a9908e4
Christian Brabandt <cb@256bit.org>
parents:
7241
diff
changeset
|
20 :set enc=utf-8 nocp viminfo+=nviminfo |
4274 | 21 : |
22 :" User functions | |
23 :function MoveToCap() | |
24 : call search('\u', 'W') | |
25 :endfunction | |
26 :function SelectInCaps() | |
27 : let [line1, col1] = searchpos('\u', 'bcnW') | |
28 : let [line2, col2] = searchpos('.\u', 'nW') | |
29 : call setpos("'<", [0, line1, col1, 0]) | |
30 : call setpos("'>", [0, line2, col2, 0]) | |
31 : normal! gv | |
32 :endfunction | |
33 : | |
34 :" Visual modes followed by operator | |
35 /^apple | |
36 lvld.l3vd.: | |
37 /^line 1 | |
38 Vcnewlinej.j2Vd.: | |
39 /^xxxx | |
40 jlc l.l2c----l.: | |
41 : | |
42 :" Visual mode maps (movement and text object) | |
43 :vnoremap W /\u/s-1<CR> | |
44 :vnoremap iW :<C-U>call SelectInCaps()<CR> | |
45 /^Kiwi | |
46 vWcNol.fD2vd.: | |
47 /^Jambu | |
48 llviWc-l.l2vdl.: | |
49 : | |
50 :" Operator-pending mode maps (movement and text object) | |
51 :onoremap W /\u/<CR> | |
52 :onoremap <Leader>W :<C-U>call MoveToCap()<CR> | |
53 :onoremap iW :<C-U>call SelectInCaps()<CR> | |
54 /^Pineapple | |
55 cW-l.l2.l.: | |
56 /^Juniper | |
57 g?\WfD.: | |
58 /^Lemon | |
4346 | 59 yiWPlciWNewfr.: |
4274 | 60 : |
61 :" Patch 7.3.879: Properly abort Operator-pending mode for "dv:<Esc>" etc. | |
62 /^zzzz | |
63 dV: dv: :set noma | let v:errmsg = '' | |
64 d: :set ma | put = v:errmsg =~# '^E21' ? 'ok' : 'failed' | |
65 dv:dV::set noma | let v:errmsg = '' | |
66 d::set ma | put = v:errmsg =~# '^E21' ? 'failed' : 'ok' | |
6826 | 67 : |
68 :$put ='' | |
69 :$put ='characterwise visual mode: replace last line' | |
70 :$put ='a' | |
71 :let @" = 'x' | |
72 :let v:errmsg = '' | |
73 v$p | |
74 :$put ='---' | |
75 :$put ='v:errmsg='.v:errmsg | |
76 : | |
77 :$put ='' | |
78 :$put ='characterwise visual mode: delete middle line' | |
79 :$put ='a' | |
80 :$put ='b' | |
81 :$put ='c' | |
82 kkv$d | |
83 :$put ='---' | |
84 : | |
85 :$put ='' | |
86 :$put ='characterwise visual mode: delete middle two line' | |
87 :$put ='a' | |
88 :$put ='b' | |
89 :$put ='c' | |
90 kkvj$d | |
91 :$put ='---' | |
92 : | |
93 :$put ='' | |
94 :$put ='characterwise visual mode: delete last line' | |
95 :$put ='a' | |
96 :$put ='b' | |
97 :$put ='c' | |
98 v$d | |
99 :$put ='---' | |
100 : | |
101 :$put ='' | |
102 :$put ='characterwise visual mode: delete last two line' | |
103 :$put ='a' | |
104 :$put ='b' | |
105 :$put ='c' | |
106 kvj$d | |
107 :$put ='---' | |
108 : | |
109 :" Select mode maps | |
110 :snoremap <lt>End> <End> | |
111 :snoremap <lt>Down> <Down> | |
112 :snoremap <lt>Del> <Del> | |
113 : | |
114 :$put ='' | |
115 :$put ='characterwise select mode: delete middle line' | |
116 :$put ='a' | |
117 :$put ='b' | |
118 :$put ='c' | |
119 kkgh<End><Del> | |
120 :$put ='---' | |
121 : | |
122 :$put ='' | |
123 :$put ='characterwise select mode: delete middle two line' | |
124 :$put ='a' | |
125 :$put ='b' | |
126 :$put ='c' | |
127 kkgh<Down><End><Del> | |
128 :$put ='---' | |
129 : | |
130 :$put ='' | |
131 :$put ='characterwise select mode: delete last line' | |
132 :$put ='a' | |
133 :$put ='b' | |
134 :$put ='c' | |
135 gh<End><Del> | |
136 :$put ='---' | |
137 : | |
138 :$put ='' | |
139 :$put ='characterwise select mode: delete last two line' | |
140 :$put ='a' | |
141 :$put ='b' | |
142 :$put ='c' | |
143 kgh<Down><End><Del> | |
144 :$put ='---' | |
145 : | |
146 :$put ='' | |
147 :$put ='linewise select mode: delete middle line' | |
148 :$put ='a' | |
149 :$put ='b' | |
150 :$put ='c' | |
151 kkgH<Del> | |
152 :$put ='---' | |
153 : | |
154 :$put ='' | |
155 :$put ='linewise select mode: delete middle two line' | |
156 :$put ='a' | |
157 :$put ='b' | |
158 :$put ='c' | |
159 kkgH<Down><Del> | |
160 :$put ='---' | |
161 : | |
162 :$put ='' | |
163 :$put ='linewise select mode: delete last line' | |
164 :$put ='a' | |
165 :$put ='b' | |
166 :$put ='c' | |
167 gH<Del> | |
168 :$put ='---' | |
169 : | |
170 :$put ='' | |
171 :$put ='linewise select mode: delete last two line' | |
172 :$put ='a' | |
173 :$put ='b' | |
174 :$put ='c' | |
175 kgH<Down><Del> | |
176 :$put ='---' | |
6845 | 177 : |
178 :$put ='' | |
179 :$put ='v_p: replace last character with line register at middle line' | |
180 :$put ='aaa' | |
181 :$put ='bbb' | |
182 :$put ='ccc' | |
183 :-2yank | |
184 k$vp | |
185 :$put ='---' | |
186 : | |
187 :$put ='' | |
188 :$put ='v_p: replace last character with line register at middle line selecting newline' | |
189 :$put ='aaa' | |
190 :$put ='bbb' | |
191 :$put ='ccc' | |
192 :-2yank | |
193 k$v$p | |
194 :$put ='---' | |
195 : | |
196 :$put ='' | |
197 :$put ='v_p: replace last character with line register at last line' | |
198 :$put ='aaa' | |
199 :$put ='bbb' | |
200 :$put ='ccc' | |
201 :-2yank | |
202 $vp | |
203 :$put ='---' | |
204 : | |
205 :$put ='' | |
206 :$put ='v_p: replace last character with line register at last line selecting newline' | |
207 :$put ='aaa' | |
208 :$put ='bbb' | |
209 :$put ='ccc' | |
210 :-2yank | |
211 $v$p | |
212 :$put ='---' | |
7241
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
213 : |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
214 :$put ='' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
215 :$put ='gv in exclusive select mode after operation' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
216 :$put ='zzz ' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
217 :$put ='äà ' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
218 :set selection=exclusive |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
219 kv3lyjv3lpgvcxxx |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
220 :$put ='---' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
221 : |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
222 :$put ='' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
223 :$put ='gv in exclusive select mode without operation' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
224 :$put ='zzz ' |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
225 :set selection=exclusive |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
226 0v3lgvcxxx |
0c1278704b5c
commit https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
Christian Brabandt <cb@256bit.org>
parents:
6845
diff
changeset
|
227 :$put ='---' |
4274 | 228 :/^start:/+2,$w! test.out |
229 :q! | |
230 ENDTEST | |
231 | |
232 start: | |
233 | |
234 apple banana cherry | |
235 | |
236 line 1 line 1 | |
237 line 2 line 2 | |
238 line 3 line 3 | |
239 line 4 line 4 | |
240 line 5 line 5 | |
241 line 6 line 6 | |
242 | |
243 xxxxxxxxxxxxx | |
244 xxxxxxxxxxxxx | |
245 xxxxxxxxxxxxx | |
246 xxxxxxxxxxxxx | |
247 | |
248 KiwiRaspberryDateWatermelonPeach | |
249 JambuRambutanBananaTangerineMango | |
250 | |
251 PineappleQuinceLoganberryOrangeGrapefruitKiwiZ | |
252 JuniperDurianZ | |
253 LemonNectarineZ | |
254 | |
255 zzzz | |
256 zzzz |