blob: 916f77e84bcef8dfbbe48c1151ec034cca047e53 [file] [log] [blame]
Bram Moolenaar3a304b22015-06-25 13:57:36 +02001Tests for using Ctrl-A/Ctrl-X on visual selections
2
3Test cases
4==========
5
61) Ctrl-A on visually selected number
7Text:
8foobar-10
Bram Moolenaar9bb19302015-07-03 12:44:07 +02009 Expected:
Bram Moolenaar3a304b22015-06-25 13:57:36 +020010 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
212) Ctrl-A on visually selected lines
22Text:
2310
2420
2530
2640
27
Bram Moolenaar9bb19302015-07-03 12:44:07 +020028 Expected:
Bram Moolenaar3a304b22015-06-25 13:57:36 +020029 1) Ctrl-A on visually selected lines:
3011
3121
3231
3341
34
35 2) Ctrl-X on visually selected lines:
369
3719
3829
3939
40
413) g Ctrl-A on visually selected lines, with non-numbers in between
42Text:
4310
44
4520
46
4730
48
4940
50
Bram Moolenaar9bb19302015-07-03 12:44:07 +020051 Expected:
Bram Moolenaar3a304b22015-06-25 13:57:36 +020052 1) 2 g Ctrl-A on visually selected lines:
5312
54
5524
56
5736
58
5948
60 2) 2 g Ctrl-X on visually selected lines
618
62
6316
64
6524
66
6732
68
694) Ctrl-A on non-number
70Text:
71foobar-10
Bram Moolenaar9bb19302015-07-03 12:44:07 +020072 Expected:
Bram Moolenaar3a304b22015-06-25 13:57:36 +020073 1) visually select foobar:
74 foobar-10
75
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200765) g<Ctrl-A> on letter
77Test:
78a
79a
80a
81a
82 Expected:
83 1) g Ctrl-A on visually selected lines
84 b
85 c
86 d
87 e
88
896) g<Ctrl-A> on letter
90Test:
91z
92z
93z
94z
95 Expected:
96 1) g Ctrl-X on visually selected lines
97 y
98 x
99 w
100 v
101
1027) <Ctrl-A> on letter
103Test:
1042
1051
1060
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
1248) Block increment on 0x9
125Text:
1260x9
1270x9
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
1369) Increment and redo
137Text:
1382
1392
140
1413
1423
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
15110) sequentially decrement 1
152Text:
1531
1541
1551
1561
157 Expected:
158 1) g Ctrl-X on visually selected lines
159 0
160 -1
161 -2
162 -3
163
16411) visually block selected indented lines
165Text:
166 1
1671
168 1
169 1
170 Expexted:
171 1) g Ctrl-A on block selected indented lines
172 2
1731
174 3
175 4
176
17712) visually selected several columns
178Text:
1790 0
1800 0
1810 0
182 Expected:
183 1) 'v' select last zero and first zeroes
184 0 1
185 1 0
186 1 0
187
Bram Moolenaar5d1bc782015-07-17 13:03:48 +020018813) visually selected part of columns
189Text:
190max: 100px
191max: 200px
192max: 300px
193max: 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
20614) redo in block mode
207Text:
2081 1
2091 1
210 Expected:
211 1) Ctrl-a on first column, redo on second column
212 2 2
213 2 2
214
21515) block select single numbers
216Text:
217101
218 Expected:
219 1) Ctrl-a on visually selected zero
220 111
221
22216) increment right aligned numbers
223Text:
224 1
225 19
226 119
227 Expected:
228 1) Ctrl-a on line selected region
229 2
230 20
231 120
232
23317) block-wise increment and redo
234Text:
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
24918) repeat of g<Ctrl-a>
250Text:
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
263
264
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200265STARTTEST
266:so small.vim
Bram Moolenaar6a57cce2015-06-28 19:24:39 +0200267:"
268:" Avoid CTRL-X being mapped in Visual mode for MS-Windows
269:vmapclear
270:"
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200271:" Test 1
272:/^S1=/+,/^E1=/-y a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200273:/^E1=/+put a
274:/^E1=/+2put a
275f-v$:/^E1=/+3put a
276f1v$:/^E1=/+4put a
277f-v$:/^E1=/+5put a
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200278f1v$
279
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200280:" Test 2
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200281:/^S2=/+,/^E2=/-y a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200282:/^E2=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200283V3k$3j:.+put a
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200284V3k$
285
286:" Test 3
287:/^S3=/+,/^E3=/-y a
288:/^E3=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200289V6k2g6j:.+put a
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200290V6k2g
291
292:" Test 4
293:/^S4=/+,/^E4=/-y a
294:/^E4=/+put a
295vf-
296
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200297:" Test 5
298:set nrformats+=alpha
299:/^S5=/+,/^E5=/-y a
300:/^E5=/+put a
301v3kg
302
303:" Test 6
304:/^S6=/+,/^E6=/-y a
305:/^E6=/+put a
306v3kg
307
308:" Test 7
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200309:set nrformats&vim
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200310:/^S7=/+,/^E7=/-y a
311:/^E7=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200312V4k4j:.+put a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200313V4k
314
315:" Test 8
316:/^S8=/+,/^E8=/-y a
317:/^E8=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200318kj$j:.+put a
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200319k$+
320
321:" Test 9
322:/^S9=/+,/^E9=/-y a
323:/^E9=/+put a
Bram Moolenaar5d1bc782015-07-17 13:03:48 +02003245kVj23j.
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200325
326:" Test 10
327:/^S10=/+,/^E10=/-y a
328:/^E10=/+put a
329V3kg
330
331: Test 11
332:/^S11=/+,/^E11=/-y a
333:/^E11=/+put a
3343kf13jg
335
336:" Test 12
337:/^S12=/+,/^E12=/-y a
338:/^E12=/+put a
3392k$v++
340
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200341:" Test 13
342:/^S13=/+,/^E13=/-y a
343:/^E13=/+put a
3443kf1l2j3j:.+put a
3453kf1l2j
346
347:" Test 14
348:/^S14=/+,/^E14=/-y a
349:/^E14=/+put a
350kw.
351
352:" Test 15
353:/^S15=/+,/^E15=/-y a
354:/^E15=/+put a
355lv
356
357:" Test 16
358:/^S16=/+,/^E16=/-y a
359:/^E16=/+put a
360V3k
361
362:" Test 17
363:/^S17=/+,/^E17=/-y a
364:/^E17=/+put a
3654kj$2j.
366
367:" Test 18
368:/^S18=/+,/^E18=/-y a
369:/^E18=/+put a
370V3kg..
371
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200372:" Save the report
373:/^# Test 1/,$w! test.out
374:qa!
375
376
377# Test 1
378S1======
379foobar-10
380E1======
381
382
383
384# Test 2
385S2=====
38610
38720
38830
38940
390E2=====
391
392
393
394# Test 3
395S3=====
39610
397
39820
399
40030
401
40240
403E3=====
404
405
406
407# Test 4
408S4=====
409foobar-10
410E4=====
411
412
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200413
414# Test 5
415S5====
416a
417a
418a
419a
420E5====
421
422
423# Test 6
424S6====
425z
426z
427z
428z
429E6====
430
431
432
433# Test 7
434S7====
4352
4361
4370
438-1
439-2
440E7====
441
442
443
444# Test 8
445S8====
4460x9
4470x9
448E8====
449
450
451
452
453# Test 9
454S9====
4552
4562
457
4583
4593
460
461E9====
462
463
464
465
466# Test 10
467S10====
4681
4691
4701
4711
472E10====
473
474
475
476
477# Test 11
478S11====
479 1
4801
481 1
482 1
483E11====
484
485
486
487# Test 12
488S12====
4890 0
4900 0
4910 0
492E12====
493
494
495
Bram Moolenaar5d1bc782015-07-17 13:03:48 +0200496# Test 13
497S13====
498max: 100px
499max: 200px
500max: 300px
501max: 400px
502E13====
503
504
505
506# Test 14
507S14====
5081 1
5091 1
510E14====
511
512
513
514# Test 15
515S15====
516101
517E15====
518
519
520
521# Test 16
522S16====
523 1
524 19
525 119
526E16====
527
528
529
530# Test 17
531S17====
532 100
533 1
534
535 100
536 1
537E17====
538
539
540# Test 18
541S18====
5420
5430
5440
5450
546E18====
Bram Moolenaar9bb19302015-07-03 12:44:07 +0200547
548
549
550
551
Bram Moolenaar3a304b22015-06-25 13:57:36 +0200552ENDTEST
553