Files
neovim/src/nvim/testdir/test_increment.in
watiko 5ef1cb5c2e vim-patch:7.4.765
Problem:    CTRL-A and CTRL-X in Visual mode do not always work well.
Solution:   Improvements for increment and decrement. (Christian Brabandt)

9bb1930af9
2016-02-01 03:43:36 +09:00

394 lines
3.5 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Tests for using Ctrl-A/Ctrl-X on visual selections
Test cases
==========
1) Ctrl-A on visually selected number
Text:
foobar-10
Expected:
1) Ctrl-A on start of line:
foobar-9
2) Ctrl-A on visually selected "-10":
foobar-9
3) Ctrl-A on visually selected "10":
foobar-11
4) Ctrl-X on visually selected "-10"
foobar-11
5) Ctrl-X on visually selected "10"
foobar-9
2) Ctrl-A on visually selected lines
Text:
10
20
30
40
Expected:
1) Ctrl-A on visually selected lines:
11
21
31
41
2) Ctrl-X on visually selected lines:
9
19
29
39
3) g Ctrl-A on visually selected lines, with non-numbers in between
Text:
10
20
30
40
Expected:
1) 2 g Ctrl-A on visually selected lines:
12
24
36
48
2) 2 g Ctrl-X on visually selected lines
8
16
24
32
4) Ctrl-A on non-number
Text:
foobar-10
Expected:
1) visually select foobar:
foobar-10
5) g<Ctrl-A> on letter
Test:
a
a
a
a
Expected:
1) g Ctrl-A on visually selected lines
b
c
d
e
6) g<Ctrl-A> on letter
Test:
z
z
z
z
Expected:
1) g Ctrl-X on visually selected lines
y
x
w
v
7) <Ctrl-A> on letter
Test:
2
1
0
-1
-2
Expected:
1) Ctrl-A on visually selected lines
3
2
1
0
-1
2) Ctrl-X on visually selected lines
1
0
-1
-2
-3
8) Block increment on 0x9
Text:
0x9
0x9
Expected:
1) Ctrl-A on visually block selected region (cursor at beginning):
0xa
0xa
2) Ctrl-A on visually block selected region (cursor at end)
0xa
0xa
9) Increment and redo
Text:
2
2
3
3
Expected:
1) 2 Ctrl-A on first 2 visually selected lines
4
4
2) redo (.) on 3
5
5
10) sequentially decrement 1
Text:
1
1
1
1
Expected:
1) g Ctrl-X on visually selected lines
0
-1
-2
-3
11) visually block selected indented lines
Text:
1
1
1
1
Expexted:
1) g Ctrl-A on block selected indented lines
2
1
3
4
12) visually selected several columns
Text:
0 0
0 0
0 0
Expected:
1) 'v' select last zero and first zeroes
0 1
1 0
1 0
STARTTEST
:so small.vim
:"
:" Avoid CTRL-X being mapped in Visual mode for MS-Windows
:vmapclear
:"
:" Test 1
:/^S1=/+,/^E1=/-y a
:/^E1=/+put a
:/^E1=/+2put a
f-v$:/^E1=/+3put a
f1v$:/^E1=/+4put a
f-v$:/^E1=/+5put a
f1v$
:" Test 22
:/^S2=/+,/^E2=/-y a
:/^E2=/+put a
V3k$:.+put a
V3k$
:" Test 3
:/^S3=/+,/^E3=/-y a
:/^E3=/+put a
V6k2g:.+put a
V6k2g
:" Test 4
:/^S4=/+,/^E4=/-y a
:/^E4=/+put a
vf-
:" Test 5
:set nrformats+=alpha
:/^S5=/+,/^E5=/-y a
:/^E5=/+put a
v3kg
:" Test 6
:/^S6=/+,/^E6=/-y a
:/^E6=/+put a
v3kg
:" Test 7
:/^S7=/+,/^E7=/-y a
:/^E7=/+put a
V4k:.+put a
V4k
:" Test 8
:/^S8=/+,/^E8=/-y a
:/^E8=/+put a
kj$:.+put a
k$+
:" Test 9
:/^S9=/+,/^E9=/-y a
:/^E9=/+put a
5kVj22j.
:" Test 10
:/^S10=/+,/^E10=/-y a
:/^E10=/+put a
V3kg
: Test 11
:/^S11=/+,/^E11=/-y a
:/^E11=/+put a
3kf13jg
:" Test 12
:/^S12=/+,/^E12=/-y a
:/^E12=/+put a
2k$v++
:" Save the report
:/^# Test 1/,$w! test.out
:qa!
# Test 1
S1======
foobar-10
E1======
# Test 2
S2=====
10
20
30
40
E2=====
# Test 3
S3=====
10
20
30
40
E3=====
# Test 4
S4=====
foobar-10
E4=====
# Test 5
S5====
a
a
a
a
E5====
# Test 6
S6====
z
z
z
z
E6====
# Test 7
S7====
2
1
0
-1
-2
E7====
# Test 8
S8====
0x9
0x9
E8====
# Test 9
S9====
2
2
3
3
E9====
# Test 10
S10====
1
1
1
1
E10====
# Test 11
S11====
1
1
1
1
E11====
# Test 12
S12====
0 0
0 0
0 0
E12====
ENDTEST