6868
|
1 Tests for using Ctrl-A/Ctrl-X on visual selections
|
|
2
|
|
3 Test cases
|
|
4 ==========
|
|
5
|
|
6 1) Ctrl-A on visually selected number
|
|
7 Text:
|
|
8 foobar-10
|
6891
|
9 Expected:
|
6868
|
10 1) Ctrl-A on start of line:
|
|
11 foobar-9
|
|
12 2) Ctrl-A on visually selected "-10":
|
|
13 foobar-9
|
|
14 3) Ctrl-A on visually selected "10":
|
|
15 foobar-11
|
|
16 4) Ctrl-X on visually selected "-10"
|
|
17 foobar-11
|
|
18 5) Ctrl-X on visually selected "10"
|
|
19 foobar-9
|
|
20
|
|
21 2) Ctrl-A on visually selected lines
|
|
22 Text:
|
|
23 10
|
|
24 20
|
|
25 30
|
|
26 40
|
|
27
|
6891
|
28 Expected:
|
6868
|
29 1) Ctrl-A on visually selected lines:
|
|
30 11
|
|
31 21
|
|
32 31
|
|
33 41
|
|
34
|
|
35 2) Ctrl-X on visually selected lines:
|
|
36 9
|
|
37 19
|
|
38 29
|
|
39 39
|
|
40
|
|
41 3) g Ctrl-A on visually selected lines, with non-numbers in between
|
|
42 Text:
|
|
43 10
|
|
44
|
|
45 20
|
|
46
|
|
47 30
|
|
48
|
|
49 40
|
|
50
|
6891
|
51 Expected:
|
6868
|
52 1) 2 g Ctrl-A on visually selected lines:
|
|
53 12
|
|
54
|
|
55 24
|
|
56
|
|
57 36
|
|
58
|
|
59 48
|
|
60 2) 2 g Ctrl-X on visually selected lines
|
|
61 8
|
|
62
|
|
63 16
|
|
64
|
|
65 24
|
|
66
|
|
67 32
|
|
68
|
|
69 4) Ctrl-A on non-number
|
|
70 Text:
|
|
71 foobar-10
|
6891
|
72 Expected:
|
6868
|
73 1) visually select foobar:
|
|
74 foobar-10
|
|
75
|
6891
|
76 5) g<Ctrl-A> on letter
|
|
77 Test:
|
|
78 a
|
|
79 a
|
|
80 a
|
|
81 a
|
|
82 Expected:
|
|
83 1) g Ctrl-A on visually selected lines
|
|
84 b
|
|
85 c
|
|
86 d
|
|
87 e
|
|
88
|
|
89 6) g<Ctrl-A> on letter
|
|
90 Test:
|
|
91 z
|
|
92 z
|
|
93 z
|
|
94 z
|
|
95 Expected:
|
|
96 1) g Ctrl-X on visually selected lines
|
|
97 y
|
|
98 x
|
|
99 w
|
|
100 v
|
|
101
|
|
102 7) <Ctrl-A> on letter
|
|
103 Test:
|
|
104 2
|
|
105 1
|
|
106 0
|
|
107 -1
|
|
108 -2
|
|
109
|
|
110 Expected:
|
|
111 1) Ctrl-A on visually selected lines
|
|
112 3
|
|
113 2
|
|
114 1
|
|
115 0
|
|
116 -1
|
|
117
|
|
118 2) Ctrl-X on visually selected lines
|
|
119 1
|
|
120 0
|
|
121 -1
|
|
122 -2
|
|
123 -3
|
|
124 8) Block increment on 0x9
|
|
125 Text:
|
|
126 0x9
|
|
127 0x9
|
|
128 Expected:
|
|
129 1) Ctrl-A on visually block selected region (cursor at beginning):
|
|
130 0xa
|
|
131 0xa
|
|
132 2) Ctrl-A on visually block selected region (cursor at end)
|
|
133 0xa
|
|
134 0xa
|
|
135
|
|
136 9) Increment and redo
|
|
137 Text:
|
|
138 2
|
|
139 2
|
|
140
|
|
141 3
|
|
142 3
|
|
143
|
|
144 Expected:
|
|
145 1) 2 Ctrl-A on first 2 visually selected lines
|
|
146 4
|
|
147 4
|
|
148 2) redo (.) on 3
|
|
149 5
|
|
150 5
|
|
151 10) sequentially decrement 1
|
|
152 Text:
|
|
153 1
|
|
154 1
|
|
155 1
|
|
156 1
|
|
157 Expected:
|
|
158 1) g Ctrl-X on visually selected lines
|
|
159 0
|
|
160 -1
|
|
161 -2
|
|
162 -3
|
|
163
|
|
164 11) visually block selected indented lines
|
|
165 Text:
|
|
166 1
|
|
167 1
|
|
168 1
|
|
169 1
|
|
170 Expexted:
|
|
171 1) g Ctrl-A on block selected indented lines
|
|
172 2
|
|
173 1
|
|
174 3
|
|
175 4
|
|
176
|
|
177 12) visually selected several columns
|
|
178 Text:
|
|
179 0 0
|
|
180 0 0
|
|
181 0 0
|
|
182 Expected:
|
|
183 1) 'v' select last zero and first zeroes
|
|
184 0 1
|
|
185 1 0
|
|
186 1 0
|
|
187
|
6927
|
188 13) visually selected part of columns
|
|
189 Text:
|
|
190 max: 100px
|
|
191 max: 200px
|
|
192 max: 300px
|
|
193 max: 400px
|
|
194 Expected:
|
|
195 1) 'v' on first two numbers Ctrl-A
|
|
196 max: 110px
|
|
197 max: 220px
|
|
198 max: 330px
|
|
199 max: 400px
|
|
200 2) 'v' on first two numbers Ctrl-X
|
|
201 max: 90px
|
|
202 max: 190px
|
|
203 max: 290px
|
|
204 max: 400px
|
|
205
|
|
206 14) redo in block mode
|
|
207 Text:
|
|
208 1 1
|
|
209 1 1
|
|
210 Expected:
|
|
211 1) Ctrl-a on first column, redo on second column
|
|
212 2 2
|
|
213 2 2
|
|
214
|
|
215 15) block select single numbers
|
|
216 Text:
|
|
217 101
|
|
218 Expected:
|
|
219 1) Ctrl-a on visually selected zero
|
|
220 111
|
|
221
|
|
222 16) increment right aligned numbers
|
|
223 Text:
|
|
224 1
|
|
225 19
|
|
226 119
|
|
227 Expected:
|
|
228 1) Ctrl-a on line selected region
|
|
229 2
|
|
230 20
|
|
231 120
|
|
232
|
|
233 17) block-wise increment and redo
|
|
234 Text:
|
|
235 100
|
|
236 1
|
|
237
|
|
238 100
|
|
239 1
|
|
240
|
|
241 Expected:
|
|
242 1) Ctrl-V j $ on first block, afterwards '.' on second
|
|
243 101
|
|
244 2
|
|
245
|
|
246 101
|
|
247 2
|
|
248
|
|
249 18) repeat of g<Ctrl-a>
|
|
250 Text:
|
|
251 0
|
|
252 0
|
|
253 0
|
|
254 0
|
|
255
|
|
256 Expected:
|
|
257 1) V 4j g<ctrl-a>, repeat twice afterwards with .
|
|
258 3
|
|
259 6
|
|
260 9
|
|
261 12
|
|
262
|
6977
|
263 19) increment on number with nrformat including alpha
|
|
264 Text:
|
|
265 1
|
|
266 1a
|
|
267
|
|
268 Expected:
|
|
269 1) <Ctrl-V>j$ <ctrl-a>
|
|
270 2
|
|
271 1b
|
|
272
|
6927
|
273
|
|
274
|
6868
|
275 STARTTEST
|
|
276 :so small.vim
|
6889
|
277 :"
|
|
278 :" Avoid CTRL-X being mapped in Visual mode for MS-Windows
|
|
279 :vmapclear
|
|
280 :"
|
6868
|
281 :" Test 1
|
|
282 :/^S1=/+,/^E1=/-y a
|
6891
|
283 :/^E1=/+put a
|
|
284 :/^E1=/+2put a
|
|
285 f-v$:/^E1=/+3put a
|
|
286 f1v$:/^E1=/+4put a
|
|
287 f-v$:/^E1=/+5put a
|
6868
|
288 f1v$
|
|
289
|
6927
|
290 :" Test 2
|
6868
|
291 :/^S2=/+,/^E2=/-y a
|
6891
|
292 :/^E2=/+put a
|
6927
|
293 V3k$3j:.+put a
|
6868
|
294 V3k$
|
|
295
|
|
296 :" Test 3
|
|
297 :/^S3=/+,/^E3=/-y a
|
|
298 :/^E3=/+put a
|
6927
|
299 V6k2g6j:.+put a
|
6868
|
300 V6k2g
|
|
301
|
|
302 :" Test 4
|
|
303 :/^S4=/+,/^E4=/-y a
|
|
304 :/^E4=/+put a
|
|
305 vf-
|
|
306
|
6891
|
307 :" Test 5
|
|
308 :set nrformats+=alpha
|
|
309 :/^S5=/+,/^E5=/-y a
|
|
310 :/^E5=/+put a
|
|
311 v3kg
|
|
312
|
|
313 :" Test 6
|
|
314 :/^S6=/+,/^E6=/-y a
|
|
315 :/^E6=/+put a
|
|
316 v3kg
|
|
317
|
|
318 :" Test 7
|
6927
|
319 :set nrformats&vim
|
6891
|
320 :/^S7=/+,/^E7=/-y a
|
|
321 :/^E7=/+put a
|
6927
|
322 V4k4j:.+put a
|
6891
|
323 V4k
|
|
324
|
|
325 :" Test 8
|
|
326 :/^S8=/+,/^E8=/-y a
|
|
327 :/^E8=/+put a
|
6927
|
328 kj$j:.+put a
|
6891
|
329 k$+
|
|
330
|
|
331 :" Test 9
|
|
332 :/^S9=/+,/^E9=/-y a
|
|
333 :/^E9=/+put a
|
6927
|
334 5kVj23j.
|
6891
|
335
|
|
336 :" Test 10
|
|
337 :/^S10=/+,/^E10=/-y a
|
|
338 :/^E10=/+put a
|
|
339 V3kg
|
|
340
|
|
341 : Test 11
|
|
342 :/^S11=/+,/^E11=/-y a
|
|
343 :/^E11=/+put a
|
|
344 3kf13jg
|
|
345
|
|
346 :" Test 12
|
|
347 :/^S12=/+,/^E12=/-y a
|
|
348 :/^E12=/+put a
|
|
349 2k$v++
|
|
350
|
6927
|
351 :" Test 13
|
|
352 :/^S13=/+,/^E13=/-y a
|
|
353 :/^E13=/+put a
|
|
354 3kf1l2j3j:.+put a
|
|
355 3kf1l2j
|
|
356
|
|
357 :" Test 14
|
|
358 :/^S14=/+,/^E14=/-y a
|
|
359 :/^E14=/+put a
|
|
360 kw.
|
|
361
|
|
362 :" Test 15
|
|
363 :/^S15=/+,/^E15=/-y a
|
|
364 :/^E15=/+put a
|
|
365 lv
|
|
366
|
|
367 :" Test 16
|
|
368 :/^S16=/+,/^E16=/-y a
|
|
369 :/^E16=/+put a
|
|
370 V3k
|
|
371
|
|
372 :" Test 17
|
|
373 :/^S17=/+,/^E17=/-y a
|
|
374 :/^E17=/+put a
|
|
375 4kj$2j.
|
|
376
|
|
377 :" Test 18
|
|
378 :/^S18=/+,/^E18=/-y a
|
|
379 :/^E18=/+put a
|
|
380 V3kg..
|
|
381
|
6977
|
382 :" Test 19
|
|
383 :set nrformats+=alpha
|
|
384 :/^S19=/+,/^E19=/-y a
|
|
385 :/^E19=/+put a
|
|
386 k$
|
|
387 :set nrformats&vim
|
|
388
|
6868
|
389 :" Save the report
|
|
390 :/^# Test 1/,$w! test.out
|
|
391 :qa!
|
|
392
|
|
393
|
|
394 # Test 1
|
|
395 S1======
|
|
396 foobar-10
|
|
397 E1======
|
|
398
|
|
399
|
|
400
|
|
401 # Test 2
|
|
402 S2=====
|
|
403 10
|
|
404 20
|
|
405 30
|
|
406 40
|
|
407 E2=====
|
|
408
|
|
409
|
|
410
|
|
411 # Test 3
|
|
412 S3=====
|
|
413 10
|
|
414
|
|
415 20
|
|
416
|
|
417 30
|
|
418
|
|
419 40
|
|
420 E3=====
|
|
421
|
|
422
|
|
423
|
|
424 # Test 4
|
|
425 S4=====
|
|
426 foobar-10
|
|
427 E4=====
|
|
428
|
|
429
|
6891
|
430
|
|
431 # Test 5
|
|
432 S5====
|
|
433 a
|
|
434 a
|
|
435 a
|
|
436 a
|
|
437 E5====
|
|
438
|
|
439
|
|
440 # Test 6
|
|
441 S6====
|
|
442 z
|
|
443 z
|
|
444 z
|
|
445 z
|
|
446 E6====
|
|
447
|
|
448
|
|
449
|
|
450 # Test 7
|
|
451 S7====
|
|
452 2
|
|
453 1
|
|
454 0
|
|
455 -1
|
|
456 -2
|
|
457 E7====
|
|
458
|
|
459
|
|
460
|
|
461 # Test 8
|
|
462 S8====
|
|
463 0x9
|
|
464 0x9
|
|
465 E8====
|
|
466
|
|
467
|
|
468
|
|
469
|
|
470 # Test 9
|
|
471 S9====
|
|
472 2
|
|
473 2
|
|
474
|
|
475 3
|
|
476 3
|
|
477
|
|
478 E9====
|
|
479
|
|
480
|
|
481
|
|
482
|
|
483 # Test 10
|
|
484 S10====
|
|
485 1
|
|
486 1
|
|
487 1
|
|
488 1
|
|
489 E10====
|
|
490
|
|
491
|
|
492
|
|
493
|
|
494 # Test 11
|
|
495 S11====
|
|
496 1
|
|
497 1
|
|
498 1
|
|
499 1
|
|
500 E11====
|
|
501
|
|
502
|
|
503
|
|
504 # Test 12
|
|
505 S12====
|
|
506 0 0
|
|
507 0 0
|
|
508 0 0
|
|
509 E12====
|
|
510
|
|
511
|
|
512
|
6927
|
513 # Test 13
|
|
514 S13====
|
|
515 max: 100px
|
|
516 max: 200px
|
|
517 max: 300px
|
|
518 max: 400px
|
|
519 E13====
|
|
520
|
|
521
|
|
522
|
|
523 # Test 14
|
|
524 S14====
|
|
525 1 1
|
|
526 1 1
|
|
527 E14====
|
|
528
|
|
529
|
|
530
|
|
531 # Test 15
|
|
532 S15====
|
|
533 101
|
|
534 E15====
|
|
535
|
|
536
|
|
537
|
|
538 # Test 16
|
|
539 S16====
|
|
540 1
|
|
541 19
|
|
542 119
|
|
543 E16====
|
|
544
|
|
545
|
|
546
|
|
547 # Test 17
|
|
548 S17====
|
|
549 100
|
|
550 1
|
|
551
|
|
552 100
|
|
553 1
|
|
554 E17====
|
|
555
|
|
556
|
|
557 # Test 18
|
|
558 S18====
|
|
559 0
|
|
560 0
|
|
561 0
|
|
562 0
|
|
563 E18====
|
6891
|
564
|
|
565
|
|
566
|
6977
|
567 # Test 19
|
|
568 S19====
|
|
569 1
|
|
570 1a
|
|
571 E19====
|
|
572
|
|
573
|
6891
|
574
|
|
575
|
6868
|
576 ENDTEST
|
|
577
|