From 4d074e39ea1228e4f04c70ecfe4e1196a9638176 Mon Sep 17 00:00:00 2001 From: watiko Date: Thu, 14 Jan 2016 17:06:55 +0900 Subject: vim-patch:7.4.754 Problem: Using CTRL-A in Visual mode does not work well. (Gary Johnson) Solution: Make it increment all numbers in the Visual area. (Christian Brabandt) https://github.com/vim/vim/commit/3a304b23823b089e499063e8211c5695d049f3ba --- src/nvim/testdir/Makefile | 3 +- src/nvim/testdir/test_increment.in | 143 +++++++++++++++++++++++++++++++++++++ src/nvim/testdir/test_increment.ok | 66 +++++++++++++++++ 3 files changed, 211 insertions(+), 1 deletion(-) create mode 100644 src/nvim/testdir/test_increment.in create mode 100644 src/nvim/testdir/test_increment.ok (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 41ce2daa91..c2fdca8514 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -28,6 +28,7 @@ SCRIPTS := \ test_charsearch.out \ test_close_count.out \ test_command_count.out \ + test_increment.out \ NEW_TESTS = @@ -131,7 +132,7 @@ test1.out: .gdbinit test1.in # Check if the test.out file matches test.ok. @/bin/sh -c "if test -f test.out; then \ - if diff test.out $*.ok; then \ + if diff -u test.out $*.ok; then \ mv -f test.out $*.out; \ else \ echo $* FAILED >> test.log; \ diff --git a/src/nvim/testdir/test_increment.in b/src/nvim/testdir/test_increment.in new file mode 100644 index 0000000000..5b0ad06cf8 --- /dev/null +++ b/src/nvim/testdir/test_increment.in @@ -0,0 +1,143 @@ +Tests for using Ctrl-A/Ctrl-X on visual selections + +Test cases +========== + +1) Ctrl-A on visually selected number +Text: +foobar-10 + 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 + + 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 + + 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 + 1) visually select foobar: + foobar-10 + +STARTTEST +:so small.vim + +:" 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- + +:" 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===== + + +ENDTEST + diff --git a/src/nvim/testdir/test_increment.ok b/src/nvim/testdir/test_increment.ok new file mode 100644 index 0000000000..4a61ad1d1d --- /dev/null +++ b/src/nvim/testdir/test_increment.ok @@ -0,0 +1,66 @@ +# Test 1 +S1====== +foobar-10 +E1====== + +foobar-9 +foobar-9 +foobar-11 +foobar-11 +foobar-9 + + +# Test 2 +S2===== +10 +20 +30 +40 +E2===== + +11 +21 +31 +41 + +9 +19 +29 +39 + +# Test 3 +S3===== +10 + +20 + +30 + +40 +E3===== + +12 + +24 + +36 + +48 + +8 + +16 + +24 + +32 + +# Test 4 +S4===== +foobar-10 +E4===== + +foobar-10 + +ENDTEST + -- cgit From 6d1b948b6b98d34b1ca8c62a7bb6d08f85f85491 Mon Sep 17 00:00:00 2001 From: watiko Date: Thu, 14 Jan 2016 18:16:44 +0900 Subject: vim-patch:7.4.764 Problem: test_increment fails on MS-Windows. (Ken Takata) Solution: Clear Visual mappings. (Taro Muraoka) https://github.com/vim/vim/commit/6a57cce04801d3e8fe30d0dcd31f9325b38de2fe --- src/nvim/testdir/test_increment.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_increment.in b/src/nvim/testdir/test_increment.in index 5b0ad06cf8..00e9ad0172 100644 --- a/src/nvim/testdir/test_increment.in +++ b/src/nvim/testdir/test_increment.in @@ -71,7 +71,10 @@ foobar-10 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 -- cgit From 5ef1cb5c2e77e3df70d93ade9afb54a3e989a3ee Mon Sep 17 00:00:00 2001 From: watiko Date: Thu, 14 Jan 2016 18:49:35 +0900 Subject: 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) https://github.com/vim/vim/commit/9bb1930af908338b68588e988be9601ad144af07 --- src/nvim/testdir/test_increment.in | 259 ++++++++++++++++++++++++++++++++++++- src/nvim/testdir/test_increment.ok | 127 ++++++++++++++++++ 2 files changed, 380 insertions(+), 6 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_increment.in b/src/nvim/testdir/test_increment.in index 00e9ad0172..45ed23b9a5 100644 --- a/src/nvim/testdir/test_increment.in +++ b/src/nvim/testdir/test_increment.in @@ -6,6 +6,7 @@ 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": @@ -24,6 +25,7 @@ Text: 30 40 + Expected: 1) Ctrl-A on visually selected lines: 11 21 @@ -46,6 +48,7 @@ Text: 40 + Expected: 1) 2 g Ctrl-A on visually selected lines: 12 @@ -66,9 +69,122 @@ Text: 4) Ctrl-A on non-number Text: foobar-10 + Expected: 1) visually select foobar: foobar-10 +5) g on letter +Test: +a +a +a +a + Expected: + 1) g Ctrl-A on visually selected lines + b + c + d + e + +6) g on letter +Test: +z +z +z +z + Expected: + 1) g Ctrl-X on visually selected lines + y + x + w + v + +7) 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 :" @@ -77,16 +193,16 @@ STARTTEST :" :" 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 +:/^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 +:/^E2=/+put a V3k$:.+put a V3k$ @@ -101,6 +217,49 @@ V6k2g :/^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! @@ -142,5 +301,93 @@ 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 diff --git a/src/nvim/testdir/test_increment.ok b/src/nvim/testdir/test_increment.ok index 4a61ad1d1d..03a10cbaa0 100644 --- a/src/nvim/testdir/test_increment.ok +++ b/src/nvim/testdir/test_increment.ok @@ -62,5 +62,132 @@ E4===== foobar-10 + +# Test 5 +S5==== +a +a +a +a +E5==== + +b +c +d +e + +# Test 6 +S6==== +z +z +z +z +E6==== + +y +x +w +v + + +# Test 7 +S7==== +2 +1 +0 +-1 +-2 +E7==== + +3 +2 +1 +0 +-1 + +1 +0 +-1 +-2 +-3 + +# Test 8 +S8==== +0x9 +0x9 +E8==== + +0xa +0xa + +0xa +0xa + + +# Test 9 +S9==== +2 +2 + +3 +3 + +E9==== + +4 +4 + +5 +5 + + + + +# Test 10 +S10==== +1 +1 +1 +1 +E10==== + +0 +-1 +-2 +-3 + + + +# Test 11 +S11==== + 1 +1 + 1 + 1 +E11==== + + 2 +1 + 3 + 4 + + +# Test 12 +S12==== +0 0 +0 0 +0 0 +E12==== + +0 1 +1 0 +1 0 + + + + + + + ENDTEST -- cgit From 43fd12629841d459214ead194410d317ef06006c Mon Sep 17 00:00:00 2001 From: watiko Date: Thu, 14 Jan 2016 20:41:22 +0900 Subject: vim-patch:7.4.782 Problem: Still a few problems with CTRL-A and CTRL-X in Visual mode. Solution: Fix the reported problems. (Christian Brabandt) https://github.com/vim/vim/commit/5d1bc78a2b9fbe3e3112afcde7c80eb19d5989f4 --- src/nvim/testdir/test_increment.in | 172 +++++++++++++++++++++++++++++++++++-- src/nvim/testdir/test_increment.ok | 74 ++++++++++++++++ 2 files changed, 240 insertions(+), 6 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_increment.in b/src/nvim/testdir/test_increment.in index 45ed23b9a5..916f77e84b 100644 --- a/src/nvim/testdir/test_increment.in +++ b/src/nvim/testdir/test_increment.in @@ -185,6 +185,83 @@ Text: 1 0 1 0 +13) visually selected part of columns +Text: +max: 100px +max: 200px +max: 300px +max: 400px + Expected: + 1) 'v' on first two numbers Ctrl-A + max: 110px + max: 220px + max: 330px + max: 400px + 2) 'v' on first two numbers Ctrl-X + max: 90px + max: 190px + max: 290px + max: 400px + +14) redo in block mode +Text: +1 1 +1 1 + Expected: + 1) Ctrl-a on first column, redo on second column + 2 2 + 2 2 + +15) block select single numbers +Text: +101 + Expected: + 1) Ctrl-a on visually selected zero + 111 + +16) increment right aligned numbers +Text: + 1 + 19 + 119 + Expected: + 1) Ctrl-a on line selected region + 2 + 20 + 120 + +17) block-wise increment and redo +Text: + 100 + 1 + + 100 + 1 + + Expected: + 1) Ctrl-V j $ on first block, afterwards '.' on second + 101 + 2 + + 101 + 2 + +18) repeat of g +Text: + 0 + 0 + 0 + 0 + + Expected: + 1) V 4j g, repeat twice afterwards with . + 3 + 6 + 9 + 12 + + + STARTTEST :so small.vim :" @@ -200,16 +277,16 @@ f1v$:/^E1=/+4put a f-v$:/^E1=/+5put a f1v$ -:" Test 22 +:" Test 2 :/^S2=/+,/^E2=/-y a :/^E2=/+put a -V3k$:.+put a +V3k$3j:.+put a V3k$ :" Test 3 :/^S3=/+,/^E3=/-y a :/^E3=/+put a -V6k2g:.+put a +V6k2g6j:.+put a V6k2g :" Test 4 @@ -229,21 +306,22 @@ v3kg v3kg :" Test 7 +:set nrformats&vim :/^S7=/+,/^E7=/-y a :/^E7=/+put a -V4k:.+put a +V4k4j:.+put a V4k :" Test 8 :/^S8=/+,/^E8=/-y a :/^E8=/+put a -kj$:.+put a +kj$j:.+put a k$+ :" Test 9 :/^S9=/+,/^E9=/-y a :/^E9=/+put a -5kVj22j. +5kVj23j. :" Test 10 :/^S10=/+,/^E10=/-y a @@ -260,6 +338,37 @@ V3kg :/^E12=/+put a 2k$v++ +:" Test 13 +:/^S13=/+,/^E13=/-y a +:/^E13=/+put a +3kf1l2j3j:.+put a +3kf1l2j + +:" Test 14 +:/^S14=/+,/^E14=/-y a +:/^E14=/+put a +kw. + +:" Test 15 +:/^S15=/+,/^E15=/-y a +:/^E15=/+put a +lv + +:" Test 16 +:/^S16=/+,/^E16=/-y a +:/^E16=/+put a +V3k + +:" Test 17 +:/^S17=/+,/^E17=/-y a +:/^E17=/+put a +4kj$2j. + +:" Test 18 +:/^S18=/+,/^E18=/-y a +:/^E18=/+put a +V3kg.. + :" Save the report :/^# Test 1/,$w! test.out :qa! @@ -384,6 +493,57 @@ E12==== +# Test 13 +S13==== +max: 100px +max: 200px +max: 300px +max: 400px +E13==== + + + +# Test 14 +S14==== +1 1 +1 1 +E14==== + + + +# Test 15 +S15==== +101 +E15==== + + + +# Test 16 +S16==== + 1 + 19 + 119 +E16==== + + + +# Test 17 +S17==== + 100 + 1 + + 100 + 1 +E17==== + + +# Test 18 +S18==== +0 +0 +0 +0 +E18==== diff --git a/src/nvim/testdir/test_increment.ok b/src/nvim/testdir/test_increment.ok index 03a10cbaa0..6ca0acce66 100644 --- a/src/nvim/testdir/test_increment.ok +++ b/src/nvim/testdir/test_increment.ok @@ -184,7 +184,81 @@ E12==== 1 0 +# Test 13 +S13==== +max: 100px +max: 200px +max: 300px +max: 400px +E13==== +max: 110px +max: 210px +max: 310px +max: 400px + +max: 90px +max: 190px +max: 290px +max: 400px + +# Test 14 +S14==== +1 1 +1 1 +E14==== + +2 2 +2 2 + + +# Test 15 +S15==== +101 +E15==== + +111 + + +# Test 16 +S16==== + 1 + 19 + 119 +E16==== + + 2 + 20 + 120 + + +# Test 17 +S17==== + 100 + 1 + + 100 + 1 +E17==== + + 101 + 2 + + 101 + 1 + +# Test 18 +S18==== +0 +0 +0 +0 +E18==== + +3 +6 +9 +12 -- cgit From d21aaef4560e73d3a1e008abb72924a01fa57c14 Mon Sep 17 00:00:00 2001 From: watiko Date: Thu, 14 Jan 2016 21:33:00 +0900 Subject: vim-patch:7.4.806 Problem: CTRL-A in Visual mode doesn't work properly with "alpha" in 'nrformat'. Solution: Make it work. (Christian Brabandt) https://github.com/vim/vim/commit/cc218ab3caf983a0dcd3399beb8e1ecfcf0dd25d --- src/nvim/testdir/test_increment.in | 24 ++++++++++++++++++++++++ src/nvim/testdir/test_increment.ok | 9 +++++++++ 2 files changed, 33 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_increment.in b/src/nvim/testdir/test_increment.in index 916f77e84b..fb7e6e3ee2 100644 --- a/src/nvim/testdir/test_increment.in +++ b/src/nvim/testdir/test_increment.in @@ -260,6 +260,16 @@ Text: 9 12 +19) increment on number with nrformat including alpha +Text: + 1 + 1a + + Expected: + 1) j$ + 2 + 1b + STARTTEST @@ -369,6 +379,13 @@ V3k :/^E18=/+put a V3kg.. +:" Test 19 +:set nrformats+=alpha +:/^S19=/+,/^E19=/-y a +:/^E19=/+put a +k$ +:set nrformats&vim + :" Save the report :/^# Test 1/,$w! test.out :qa! @@ -547,6 +564,13 @@ E18==== +# Test 19 +S19==== +1 +1a +E19==== + + ENDTEST diff --git a/src/nvim/testdir/test_increment.ok b/src/nvim/testdir/test_increment.ok index 6ca0acce66..685478e668 100644 --- a/src/nvim/testdir/test_increment.ok +++ b/src/nvim/testdir/test_increment.ok @@ -261,6 +261,15 @@ E18==== 12 +# Test 19 +S19==== +1 +1a +E19==== + +2 +2a + ENDTEST -- cgit From 61a3b14726fe54ac6a8949cad79a91ce9b6739a9 Mon Sep 17 00:00:00 2001 From: watiko Date: Thu, 14 Jan 2016 21:37:25 +0900 Subject: vim-patch:7.4.823 Problem: Cursor moves after CTRL-A on alphabetic character. Solution: (Hirohito Higashi, test by Christian Brabandt) https://github.com/vim/vim/commit/25c2f6783a9d5f15e062bd5b085abe7deb121152 --- src/nvim/testdir/test_increment.in | 24 +++++++++++++++++++++++- src/nvim/testdir/test_increment.ok | 9 +++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_increment.in b/src/nvim/testdir/test_increment.in index fb7e6e3ee2..ecbc6f99a1 100644 --- a/src/nvim/testdir/test_increment.in +++ b/src/nvim/testdir/test_increment.in @@ -268,7 +268,15 @@ Text: Expected: 1) j$ 2 - 1b + 2a + +20) increment a single letter +Text: + a + + Expected: + 1) and cursor is on a + b @@ -386,6 +394,13 @@ V3kg.. k$ :set nrformats&vim +:" Test 20 +:set nrformats+=alpha +:/^S20=/+,/^E20=/-y a +:/^E20=/+put a +:.put =col('.') +:set nrformats&vim + :" Save the report :/^# Test 1/,$w! test.out :qa! @@ -572,6 +587,13 @@ E19==== +# Test 20 +S20==== +a +E20==== + + + ENDTEST diff --git a/src/nvim/testdir/test_increment.ok b/src/nvim/testdir/test_increment.ok index 685478e668..48e722f038 100644 --- a/src/nvim/testdir/test_increment.ok +++ b/src/nvim/testdir/test_increment.ok @@ -271,6 +271,15 @@ E19==== 2a +# Test 20 +S20==== +a +E20==== + +b +1 + + ENDTEST -- cgit From 1e94262efe6e059103698365d82ba02d6172dc57 Mon Sep 17 00:00:00 2001 From: watiko Date: Thu, 14 Jan 2016 21:43:26 +0900 Subject: vim-patch:7.4.848 Problem: CTRL-A on hex number in Visual block mode is incorrect. Solution: Account for the "0x". (Hirohito Higashi) https://github.com/vim/vim/commit/5adfea1ac63e252556bccce54e92e8e10b58f592 --- src/nvim/testdir/test_increment.in | 23 ++++++++++++++++++++++- src/nvim/testdir/test_increment.ok | 8 ++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_increment.in b/src/nvim/testdir/test_increment.in index ecbc6f99a1..2ae6b8a563 100644 --- a/src/nvim/testdir/test_increment.in +++ b/src/nvim/testdir/test_increment.in @@ -277,7 +277,15 @@ Text: Expected: 1) and cursor is on a b - + +21) block-wise increment on part of hexadecimal +Text: +0x123456 + + Expected: + 1) Ctrl-V f3 +0x124456 + STARTTEST @@ -401,6 +409,12 @@ V3kg.. :.put =col('.') :set nrformats&vim +:" Test 21 +:/^S21=/+,/^E21=/-y a +:/^E21=/+put a +:set nrformats&vim +f3 + :" Save the report :/^# Test 1/,$w! test.out :qa! @@ -594,6 +608,13 @@ E20==== +# Test 21 +S21==== +0x123456 +E21==== + + + ENDTEST diff --git a/src/nvim/testdir/test_increment.ok b/src/nvim/testdir/test_increment.ok index 48e722f038..15d0e9b50b 100644 --- a/src/nvim/testdir/test_increment.ok +++ b/src/nvim/testdir/test_increment.ok @@ -280,6 +280,14 @@ b 1 +# Test 21 +S21==== +0x123456 +E21==== + +0x124456 + + ENDTEST -- cgit From a5f361e470c816ec9258fb815befafdef52b000b Mon Sep 17 00:00:00 2001 From: watiko Date: Fri, 15 Jan 2016 15:06:12 +0900 Subject: vim-patch:7.4.1027 Problem: No support for binary numbers. Solution: Add "bin" to nrformats. (Jason Schulz) https://github.com/vim/vim/commit/887c1fea4a114e7170091942d0446c8882701b5b --- src/nvim/testdir/test_increment.in | 114 +++++++++++++++++++++++++++++++++++++ src/nvim/testdir/test_increment.ok | 47 +++++++++++++++ 2 files changed, 161 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_increment.in b/src/nvim/testdir/test_increment.in index 2ae6b8a563..753951d40c 100644 --- a/src/nvim/testdir/test_increment.in +++ b/src/nvim/testdir/test_increment.in @@ -286,6 +286,49 @@ Text: 1) Ctrl-V f3 0x124456 +22) Block increment on 0b0 +Text: +0b1 +0b1 + Expected: + 1) Ctrl-A on visually block selected region (cursor at beginning): + 0b10 + 0b10 + 2) Ctrl-A on visually block selected region (cursor at end) + 0b10 + 0b10 + +23) block-wise increment on part of binary +Text: +0b1001 + + Expected: + 1) Ctrl-V 5l +0b1011 + +24) increment hexadecimal +Text: +0x0b1001 + + Expected: + 1) +0x0b1002 + +25) increment binary with nrformats including alpha +Text: +0b1001a + + Expected: + 1) +0b1010a + +26) increment binary with 64 bits +Text: +0b1111111111111111111111111111111111111111111111111111111111111110 + + Expected: + 1) +0b1111111111111111111111111111111111111111111111111111111111111111 STARTTEST @@ -415,6 +458,38 @@ V3kg.. :set nrformats&vim f3 +:" Test 22 +:/^S22=/+,/^E22=/-y a +:/^E22=/+put a +kj$j:.+put a +k$+ + +:" Test 23 +:/^S23=/+,/^E23=/-y a +:/^E23=/+put a +:set nrformats&vim +4l + +:" Test 24 +:/^S24=/+,/^E24=/-y a +:/^E24=/+put a +:set nrformats&vim +$ + +:" Test 25 +:set nrformats+=alpha +:/^S25=/+,/^E25=/-y a +:/^E25=/+put a +k$ +:set nrformats&vim + +:" Test 26 +:set nrformats+=alpha +:/^S26=/+,/^E26=/-y a +:/^E26=/+put a +k$ +:set nrformats&vim + :" Save the report :/^# Test 1/,$w! test.out :qa! @@ -615,6 +690,45 @@ E21==== +# Test 22 +S22==== +0b1 +0b1 +E22==== + + + + +# Test 23 +S23==== +0b1001 +E23==== + + + + +# Test 24 +S24==== +0x0b1001 +E24==== + + + + +# Test 25 +S25==== +0b1001a +E25==== + + + + +# Test 26 +S26==== +0b1111111111111111111111111111111111111111111111111111111111111110 +E26==== + + ENDTEST diff --git a/src/nvim/testdir/test_increment.ok b/src/nvim/testdir/test_increment.ok index 15d0e9b50b..4d8fbb0ae1 100644 --- a/src/nvim/testdir/test_increment.ok +++ b/src/nvim/testdir/test_increment.ok @@ -288,6 +288,53 @@ E21==== 0x124456 +# Test 22 +S22==== +0b1 +0b1 +E22==== + +0b10 +0b10 + +0b10 +0b10 + + +# Test 23 +S23==== +0b1001 +E23==== + +0b1011 + + + +# Test 24 +S24==== +0x0b1001 +E24==== + +0x0b1002 + + + +# Test 25 +S25==== +0b1001a +E25==== + +0b1010a + + + +# Test 26 +S26==== +0b1111111111111111111111111111111111111111111111111111111111111110 +E26==== + +0b1111111111111111111111111111111111111111111111111111111111111111 + ENDTEST -- cgit From a6e4271c15f9cad09ce69bc2b629c10556ac762d Mon Sep 17 00:00:00 2001 From: watiko Date: Fri, 15 Jan 2016 17:11:28 +0900 Subject: vim-patch:7.4.1029 Problem: test_increment fails on systems with 32 bit long. Solution: Only test with 32 bits. https://github.com/vim/vim/commit/d3343960d7745bd586197a28b9a96d634a292422 --- src/nvim/testdir/test_increment.in | 2 +- src/nvim/testdir/test_increment.ok | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_increment.in b/src/nvim/testdir/test_increment.in index 753951d40c..f5d8ff9c3e 100644 --- a/src/nvim/testdir/test_increment.in +++ b/src/nvim/testdir/test_increment.in @@ -725,7 +725,7 @@ E25==== # Test 26 S26==== -0b1111111111111111111111111111111111111111111111111111111111111110 +0b11111111111111111111111111111110 E26==== diff --git a/src/nvim/testdir/test_increment.ok b/src/nvim/testdir/test_increment.ok index 4d8fbb0ae1..77ce9d4156 100644 --- a/src/nvim/testdir/test_increment.ok +++ b/src/nvim/testdir/test_increment.ok @@ -330,10 +330,10 @@ E25==== # Test 26 S26==== -0b1111111111111111111111111111111111111111111111111111111111111110 +0b11111111111111111111111111111110 E26==== -0b1111111111111111111111111111111111111111111111111111111111111111 +0b11111111111111111111111111111111 ENDTEST -- cgit From 63560c9c89a85a5e034e39b785666776371c1a7e Mon Sep 17 00:00:00 2001 From: watiko Date: Fri, 15 Jan 2016 17:28:15 +0900 Subject: vim-patch:7.4.1072 Problem: Increment test is old style. Solution: Make the increment test a new style test. (Hirohito Higashi) https://github.com/vim/vim/commit/450919587d4566ce3d17e685e183d5c17d9c2a11 https://github.com/vim/vim/commit/44132a10aeb45c957959cafb4ac39d3f478be98c --- src/nvim/testdir/Makefile | 3 +- src/nvim/testdir/test_increment.in | 734 ------------------------------------ src/nvim/testdir/test_increment.ok | 340 ----------------- src/nvim/testdir/test_increment.vim | 561 +++++++++++++++++++++++++++ 4 files changed, 562 insertions(+), 1076 deletions(-) delete mode 100644 src/nvim/testdir/test_increment.in delete mode 100644 src/nvim/testdir/test_increment.ok create mode 100644 src/nvim/testdir/test_increment.vim (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index c2fdca8514..db8547753d 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -28,9 +28,8 @@ SCRIPTS := \ test_charsearch.out \ test_close_count.out \ test_command_count.out \ - test_increment.out \ -NEW_TESTS = +NEW_TESTS = test_increment.res SCRIPTS_GUI := test16.out diff --git a/src/nvim/testdir/test_increment.in b/src/nvim/testdir/test_increment.in deleted file mode 100644 index f5d8ff9c3e..0000000000 --- a/src/nvim/testdir/test_increment.in +++ /dev/null @@ -1,734 +0,0 @@ -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 on letter -Test: -a -a -a -a - Expected: - 1) g Ctrl-A on visually selected lines - b - c - d - e - -6) g on letter -Test: -z -z -z -z - Expected: - 1) g Ctrl-X on visually selected lines - y - x - w - v - -7) 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 - -13) visually selected part of columns -Text: -max: 100px -max: 200px -max: 300px -max: 400px - Expected: - 1) 'v' on first two numbers Ctrl-A - max: 110px - max: 220px - max: 330px - max: 400px - 2) 'v' on first two numbers Ctrl-X - max: 90px - max: 190px - max: 290px - max: 400px - -14) redo in block mode -Text: -1 1 -1 1 - Expected: - 1) Ctrl-a on first column, redo on second column - 2 2 - 2 2 - -15) block select single numbers -Text: -101 - Expected: - 1) Ctrl-a on visually selected zero - 111 - -16) increment right aligned numbers -Text: - 1 - 19 - 119 - Expected: - 1) Ctrl-a on line selected region - 2 - 20 - 120 - -17) block-wise increment and redo -Text: - 100 - 1 - - 100 - 1 - - Expected: - 1) Ctrl-V j $ on first block, afterwards '.' on second - 101 - 2 - - 101 - 2 - -18) repeat of g -Text: - 0 - 0 - 0 - 0 - - Expected: - 1) V 4j g, repeat twice afterwards with . - 3 - 6 - 9 - 12 - -19) increment on number with nrformat including alpha -Text: - 1 - 1a - - Expected: - 1) j$ - 2 - 2a - -20) increment a single letter -Text: - a - - Expected: - 1) and cursor is on a - b - -21) block-wise increment on part of hexadecimal -Text: -0x123456 - - Expected: - 1) Ctrl-V f3 -0x124456 - -22) Block increment on 0b0 -Text: -0b1 -0b1 - Expected: - 1) Ctrl-A on visually block selected region (cursor at beginning): - 0b10 - 0b10 - 2) Ctrl-A on visually block selected region (cursor at end) - 0b10 - 0b10 - -23) block-wise increment on part of binary -Text: -0b1001 - - Expected: - 1) Ctrl-V 5l -0b1011 - -24) increment hexadecimal -Text: -0x0b1001 - - Expected: - 1) -0x0b1002 - -25) increment binary with nrformats including alpha -Text: -0b1001a - - Expected: - 1) -0b1010a - -26) increment binary with 64 bits -Text: -0b1111111111111111111111111111111111111111111111111111111111111110 - - Expected: - 1) -0b1111111111111111111111111111111111111111111111111111111111111111 - - -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 2 -:/^S2=/+,/^E2=/-y a -:/^E2=/+put a -V3k$3j:.+put a -V3k$ - -:" Test 3 -:/^S3=/+,/^E3=/-y a -:/^E3=/+put a -V6k2g6j:.+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 -:set nrformats&vim -:/^S7=/+,/^E7=/-y a -:/^E7=/+put a -V4k4j:.+put a -V4k - -:" Test 8 -:/^S8=/+,/^E8=/-y a -:/^E8=/+put a -kj$j:.+put a -k$+ - -:" Test 9 -:/^S9=/+,/^E9=/-y a -:/^E9=/+put a -5kVj23j. - -:" 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++ - -:" Test 13 -:/^S13=/+,/^E13=/-y a -:/^E13=/+put a -3kf1l2j3j:.+put a -3kf1l2j - -:" Test 14 -:/^S14=/+,/^E14=/-y a -:/^E14=/+put a -kw. - -:" Test 15 -:/^S15=/+,/^E15=/-y a -:/^E15=/+put a -lv - -:" Test 16 -:/^S16=/+,/^E16=/-y a -:/^E16=/+put a -V3k - -:" Test 17 -:/^S17=/+,/^E17=/-y a -:/^E17=/+put a -4kj$2j. - -:" Test 18 -:/^S18=/+,/^E18=/-y a -:/^E18=/+put a -V3kg.. - -:" Test 19 -:set nrformats+=alpha -:/^S19=/+,/^E19=/-y a -:/^E19=/+put a -k$ -:set nrformats&vim - -:" Test 20 -:set nrformats+=alpha -:/^S20=/+,/^E20=/-y a -:/^E20=/+put a -:.put =col('.') -:set nrformats&vim - -:" Test 21 -:/^S21=/+,/^E21=/-y a -:/^E21=/+put a -:set nrformats&vim -f3 - -:" Test 22 -:/^S22=/+,/^E22=/-y a -:/^E22=/+put a -kj$j:.+put a -k$+ - -:" Test 23 -:/^S23=/+,/^E23=/-y a -:/^E23=/+put a -:set nrformats&vim -4l - -:" Test 24 -:/^S24=/+,/^E24=/-y a -:/^E24=/+put a -:set nrformats&vim -$ - -:" Test 25 -:set nrformats+=alpha -:/^S25=/+,/^E25=/-y a -:/^E25=/+put a -k$ -:set nrformats&vim - -:" Test 26 -:set nrformats+=alpha -:/^S26=/+,/^E26=/-y a -:/^E26=/+put a -k$ -:set nrformats&vim - -:" 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==== - - - -# Test 13 -S13==== -max: 100px -max: 200px -max: 300px -max: 400px -E13==== - - - -# Test 14 -S14==== -1 1 -1 1 -E14==== - - - -# Test 15 -S15==== -101 -E15==== - - - -# Test 16 -S16==== - 1 - 19 - 119 -E16==== - - - -# Test 17 -S17==== - 100 - 1 - - 100 - 1 -E17==== - - -# Test 18 -S18==== -0 -0 -0 -0 -E18==== - - - -# Test 19 -S19==== -1 -1a -E19==== - - - -# Test 20 -S20==== -a -E20==== - - - -# Test 21 -S21==== -0x123456 -E21==== - - - -# Test 22 -S22==== -0b1 -0b1 -E22==== - - - - -# Test 23 -S23==== -0b1001 -E23==== - - - - -# Test 24 -S24==== -0x0b1001 -E24==== - - - - -# Test 25 -S25==== -0b1001a -E25==== - - - - -# Test 26 -S26==== -0b11111111111111111111111111111110 -E26==== - - - -ENDTEST - diff --git a/src/nvim/testdir/test_increment.ok b/src/nvim/testdir/test_increment.ok deleted file mode 100644 index 77ce9d4156..0000000000 --- a/src/nvim/testdir/test_increment.ok +++ /dev/null @@ -1,340 +0,0 @@ -# Test 1 -S1====== -foobar-10 -E1====== - -foobar-9 -foobar-9 -foobar-11 -foobar-11 -foobar-9 - - -# Test 2 -S2===== -10 -20 -30 -40 -E2===== - -11 -21 -31 -41 - -9 -19 -29 -39 - -# Test 3 -S3===== -10 - -20 - -30 - -40 -E3===== - -12 - -24 - -36 - -48 - -8 - -16 - -24 - -32 - -# Test 4 -S4===== -foobar-10 -E4===== - -foobar-10 - - -# Test 5 -S5==== -a -a -a -a -E5==== - -b -c -d -e - -# Test 6 -S6==== -z -z -z -z -E6==== - -y -x -w -v - - -# Test 7 -S7==== -2 -1 -0 --1 --2 -E7==== - -3 -2 -1 -0 --1 - -1 -0 --1 --2 --3 - -# Test 8 -S8==== -0x9 -0x9 -E8==== - -0xa -0xa - -0xa -0xa - - -# Test 9 -S9==== -2 -2 - -3 -3 - -E9==== - -4 -4 - -5 -5 - - - - -# Test 10 -S10==== -1 -1 -1 -1 -E10==== - -0 --1 --2 --3 - - - -# Test 11 -S11==== - 1 -1 - 1 - 1 -E11==== - - 2 -1 - 3 - 4 - - -# Test 12 -S12==== -0 0 -0 0 -0 0 -E12==== - -0 1 -1 0 -1 0 - - -# Test 13 -S13==== -max: 100px -max: 200px -max: 300px -max: 400px -E13==== - -max: 110px -max: 210px -max: 310px -max: 400px - -max: 90px -max: 190px -max: 290px -max: 400px - -# Test 14 -S14==== -1 1 -1 1 -E14==== - -2 2 -2 2 - - -# Test 15 -S15==== -101 -E15==== - -111 - - -# Test 16 -S16==== - 1 - 19 - 119 -E16==== - - 2 - 20 - 120 - - -# Test 17 -S17==== - 100 - 1 - - 100 - 1 -E17==== - - 101 - 2 - - 101 - 1 - -# Test 18 -S18==== -0 -0 -0 -0 -E18==== - -3 -6 -9 -12 - - -# Test 19 -S19==== -1 -1a -E19==== - -2 -2a - - -# Test 20 -S20==== -a -E20==== - -b -1 - - -# Test 21 -S21==== -0x123456 -E21==== - -0x124456 - - -# Test 22 -S22==== -0b1 -0b1 -E22==== - -0b10 -0b10 - -0b10 -0b10 - - -# Test 23 -S23==== -0b1001 -E23==== - -0b1011 - - - -# Test 24 -S24==== -0x0b1001 -E24==== - -0x0b1002 - - - -# Test 25 -S25==== -0b1001a -E25==== - -0b1010a - - - -# Test 26 -S26==== -0b11111111111111111111111111111110 -E26==== - -0b11111111111111111111111111111111 - - -ENDTEST - diff --git a/src/nvim/testdir/test_increment.vim b/src/nvim/testdir/test_increment.vim new file mode 100644 index 0000000000..ab75c1c6eb --- /dev/null +++ b/src/nvim/testdir/test_increment.vim @@ -0,0 +1,561 @@ +" Tests for using Ctrl-A/Ctrl-X on visual selections + +func SetUp() + new dummy + set nrformats&vim +endfunc + +func TearDown() + bwipe! +endfunc + +" 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 +func Test_visual_increment_01() + call setline(1, repeat(["foobaar-10"], 5)) + + call cursor(1, 1) + exec "norm! \" + call assert_equal("foobaar-9", getline('.')) + call assert_equal([0, 1, 9, 0], getpos('.')) + + call cursor(2, 1) + exec "norm! f-v$\" + call assert_equal("foobaar-9", getline('.')) + call assert_equal([0, 2, 8, 0], getpos('.')) + + call cursor(3, 1) + exec "norm! f1v$\" + call assert_equal("foobaar-11", getline('.')) + call assert_equal([0, 3, 9, 0], getpos('.')) + + call cursor(4, 1) + exec "norm! f-v$\" + call assert_equal("foobaar-11", getline('.')) + call assert_equal([0, 4, 8, 0], getpos('.')) + + call cursor(5, 1) + exec "norm! f1v$\" + call assert_equal("foobaar-9", getline('.')) + call assert_equal([0, 5, 9, 0], getpos('.')) +endfunc + +" 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 +func Test_visual_increment_02() + call setline(1, ["10", "20", "30", "40"]) + exec "norm! GV3k$\" + call assert_equal(["11", "21", "31", "41"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + call setline(1, ["10", "20", "30", "40"]) + exec "norm! GV3k$\" + call assert_equal(["9", "19", "29", "39"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 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 +func Test_visual_increment_03() + call setline(1, ["10", "", "20", "", "30", "", "40"]) + exec "norm! GV6k2g\" + call assert_equal(["12", "", "24", "", "36", "", "48"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + call setline(1, ["10", "", "20", "", "30", "", "40"]) + exec "norm! GV6k2g\" + call assert_equal(["8", "", "16", "", "24", "", "32"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 4) Ctrl-A on non-number +" Text: +" foobar-10 +" Expected: +" 1) visually select foobar: +" foobar-10 +func Test_visual_increment_04() + call setline(1, ["foobar-10"]) + exec "norm! vf-\" + call assert_equal(["foobar-10"], getline(1, '$')) + " NOTE: I think this is correct behavior... + "call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 5) g on letter +" Test: +" a +" a +" a +" a +" Expected: +" 1) g Ctrl-A on visually selected lines +" b +" c +" d +" e +func Test_visual_increment_05() + set nrformats+=alpha + call setline(1, repeat(["a"], 4)) + exec "norm! GV3kg\" + call assert_equal(["b", "c", "d", "e"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 6) g on letter +" Test: +" z +" z +" z +" z +" Expected: +" 1) g Ctrl-X on visually selected lines +" y +" x +" w +" v +func Test_visual_increment_06() + set nrformats+=alpha + call setline(1, repeat(["z"], 4)) + exec "norm! GV3kg\" + call assert_equal(["y", "x", "w", "v"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 7) 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 +func Test_visual_increment_07() + call setline(1, ["2", "1", "0", "-1", "-2"]) + exec "norm! GV4k\" + call assert_equal(["3", "2", "1", "0", "-1"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + call setline(1, ["2", "1", "0", "-1", "-2"]) + exec "norm! GV4k\" + call assert_equal(["1", "0", "-1", "-2", "-3"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 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 +func Test_visual_increment_08() + call setline(1, repeat(["0x9"], 2)) + exec "norm! \j$\" + call assert_equal(["0xa", "0xa"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + call setline(1, repeat(["0x9"], 2)) + exec "norm! gg$\+\" + call assert_equal(["0xa", "0xa"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 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 +func Test_visual_increment_09() + call setline(1, ["2", "2", "", "3", "3", ""]) + exec "norm! ggVj2\" + call assert_equal(["4", "4", "", "3", "3", ""], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + exec "norm! 3j." + call assert_equal(["4", "4", "", "5", "5", ""], getline(1, '$')) + call assert_equal([0, 4, 1, 0], getpos('.')) +endfunc + +" 10) sequentially decrement 1 +" Text: +" 1 +" 1 +" 1 +" 1 +" Expected: +" 1) g Ctrl-X on visually selected lines +" 0 +" -1 +" -2 +" -3 +func Test_visual_increment_10() + call setline(1, repeat(["1"], 4)) + exec "norm! GV3kg\" + call assert_equal(["0", "-1", "-2", "-3"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 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 +func Test_visual_increment_11() + call setline(1, [" 1", "1", " 1", " 1"]) + exec "norm! f1\3jg\" + call assert_equal([" 2", "1", " 3", " 4"], getline(1, '$')) + call assert_equal([0, 1, 5, 0], getpos('.')) +endfunc + +" 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 +func Test_visual_increment_12() + call setline(1, repeat(["0 0"], 3)) + exec "norm! $v++\" + call assert_equal(["0 1", "1 0", "1 0"], getline(1, '$')) + call assert_equal([0, 1, 3, 0], getpos('.')) +endfunc + +" 13) visually selected part of columns +" Text: +" max: 100px +" max: 200px +" max: 300px +" max: 400px +" Expected: +" 1) 'v' on first two numbers Ctrl-A +" max: 110px +" max: 220px +" max: 330px +" max: 400px +" 2) 'v' on first two numbers Ctrl-X +" max: 90px +" max: 190px +" max: 290px +" max: 400px +func Test_visual_increment_13() + call setline(1, ["max: 100px", "max: 200px", "max: 300px", "max: 400px"]) + exec "norm! f1\l2j\" + call assert_equal(["max: 110px", "max: 210px", "max: 310px", "max: 400px"], getline(1, '$')) + call assert_equal([0, 1, 6, 0], getpos('.')) + + call setline(1, ["max: 100px", "max: 200px", "max: 300px", "max: 400px"]) + exec "norm! ggf1\l2j\" + call assert_equal(["max: 90px", "max: 190px", "max: 290px", "max: 400px"], getline(1, '$')) + call assert_equal([0, 1, 6, 0], getpos('.')) +endfunc + +" 14) redo in block mode +" Text: +" 1 1 +" 1 1 +" Expected: +" 1) Ctrl-a on first column, redo on second column +" 2 2 +" 2 2 +func Test_visual_increment_14() + call setline(1, repeat(["1 1"], 2)) + exec "norm! G\k\w." + call assert_equal(["2 2", "2 2"], getline(1, '$')) + call assert_equal([0, 1, 3, 0], getpos('.')) +endfunc + +" 15) block select single numbers +" Text: +" 101 +" Expected: +" 1) Ctrl-a on visually selected zero +" 111 +func Test_visual_increment_15() + call setline(1, ["101"]) + exec "norm! lv\" + call assert_equal(["111"], getline(1, '$')) + call assert_equal([0, 1, 2, 0], getpos('.')) +endfunc + +" 16) increment right aligned numbers +" Text: +" 1 +" 19 +" 119 +" Expected: +" 1) Ctrl-a on line selected region +" 2 +" 20 +" 120 +func Test_visual_increment_16() + call setline(1, [" 1", " 19", " 119"]) + exec "norm! VG\" + call assert_equal([" 2", " 20", " 120"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 17) block-wise increment and redo +" Text: +" 100 +" 1 +" +" 100 +" 1 +" +" Expected: +" 1) Ctrl-V j $ on first block, afterwards '.' on second +" 101 +" 2 +" +" 101 +" 2 +func Test_visual_increment_17() + call setline(1, [" 100", " 1", "", " 100", " 1"]) + exec "norm! \j$\2j." + call assert_equal([" 101", " 2", "", " 101", " 1"], getline(1, '$')) + call assert_equal([0, 3, 1, 0], getpos('.')) +endfunc + +" 18) repeat of g +" Text: +" 0 +" 0 +" 0 +" 0 +" +" Expected: +" 1) V 4j g, repeat twice afterwards with . +" 3 +" 6 +" 9 +" 12 +func Test_visual_increment_18() + call setline(1, repeat(["0"], 4)) + exec "norm! GV3kg\" + exec "norm! .." + call assert_equal(["3", "6", "9", "12"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 19) increment on number with nrformat including alpha +" Text: +" 1 +" 1a +" +" Expected: +" 1) j$ +" 2 +" 2a +func Test_visual_increment_19() + set nrformats+=alpha + call setline(1, ["1", "1a"]) + exec "norm! \G$\" + call assert_equal(["2", "2a"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 20) increment a single letter +" Text: +" a +" +" Expected: +" 1) and cursor is on a +" b +func Test_visual_increment_20() + set nrformats+=alpha + call setline(1, ["a"]) + exec "norm! \" + call assert_equal(["b"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 21) block-wise increment on part of hexadecimal +" Text: +" 0x123456 +" +" Expected: +" 1) Ctrl-V f3 +" 0x124456 +func Test_visual_increment_21() + call setline(1, ["0x123456"]) + exec "norm! \f3\" + call assert_equal(["0x124456"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 22) Block increment on 0b0 +" Text: +" 0b1 +" 0b1 +" Expected: +" 1) Ctrl-A on visually block selected region (cursor at beginning): +" 0b10 +" 0b10 +" 2) Ctrl-A on visually block selected region (cursor at end) +" 0b10 +" 0b10 +func Test_visual_increment_22() + call setline(1, repeat(["0b1"], 2)) + exec "norm! \j$\" + call assert_equal(repeat(["0b10"], 2), getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + call setline(1, repeat(["0b1"], 2)) + exec "norm! $\+\" + call assert_equal(repeat(["0b10"], 2), getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 23) block-wise increment on part of binary +" Text: +" 0b1001 +" +" Expected: +" 1) Ctrl-V 5l +" 0b1011 +func Test_visual_increment_23() + call setline(1, ["0b1001"]) + exec "norm! \4l\" + call assert_equal(["0b1011"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 24) increment hexadecimal +" Text: +" 0x0b1001 +" +" Expected: +" 1) +" 0x0b1002 +func Test_visual_increment_24() + call setline(1, ["0x0b1001"]) + exec "norm! \$\" + call assert_equal(["0x0b1002"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 25) increment binary with nrformats including alpha +" Text: +" 0b1001a +" +" Expected: +" 1) +" 0b1010a +func Test_visual_increment_25() + set nrformats+=alpha + call setline(1, ["0b1001a"]) + exec "norm! \$\" + call assert_equal(["0b1010a"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" 26) increment binary with 32 bits +" Text: +" 0b11111111111111111111111111111110 +" +" Expected: +" 1) +" 0b11111111111111111111111111111111 +func Test_visual_increment_26() + set nrformats+=alpha + call setline(1, ["0b11111111111111111111111111111110"]) + exec "norm! \$\" + call assert_equal(["0b11111111111111111111111111111111"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" vim: tabstop=2 shiftwidth=2 expandtab -- cgit From 594e3a64de2f2a0aac2dfdebbf5881ee3403c275 Mon Sep 17 00:00:00 2001 From: watiko Date: Fri, 15 Jan 2016 17:51:56 +0900 Subject: vim-patch:7.4.1076 Problem: CTRL-A does not work well in right-left mode. Solution: Remove reversing the line, add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c --- src/nvim/testdir/test_increment.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_increment.vim b/src/nvim/testdir/test_increment.vim index ab75c1c6eb..277f71d8a4 100644 --- a/src/nvim/testdir/test_increment.vim +++ b/src/nvim/testdir/test_increment.vim @@ -558,4 +558,21 @@ func Test_visual_increment_26() call assert_equal([0, 1, 1, 0], getpos('.')) endfunc +" 27) increment with 'rightreft', if supported +func Test_visual_increment_27() + if exists('+rightleft') + set rightleft + call setline(1, ["1234 56"]) + + exec "norm! $\" + call assert_equal(["1234 57"], getline(1, '$')) + call assert_equal([0, 1, 7, 0], getpos('.')) + + exec "norm! \" + call assert_equal(["1234 58"], getline(1, '$')) + call assert_equal([0, 1, 7, 0], getpos('.')) + set norightleft + endif +endfunc + " vim: tabstop=2 shiftwidth=2 expandtab -- cgit From 2f52ae18e75a85af78b78587d5b44b6d8d4814b7 Mon Sep 17 00:00:00 2001 From: watiko Date: Fri, 15 Jan 2016 18:07:45 +0900 Subject: vim-patch:7.4.1084 Problem: Using "." to repeat CTRL-A in Visual mode increments the wrong numbers. Solution: Append right size to the redo buffer. (Ozaki Kiichi) https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe --- src/nvim/testdir/test_increment.vim | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_increment.vim b/src/nvim/testdir/test_increment.vim index 277f71d8a4..51cc45f98d 100644 --- a/src/nvim/testdir/test_increment.vim +++ b/src/nvim/testdir/test_increment.vim @@ -556,6 +556,7 @@ func Test_visual_increment_26() exec "norm! \$\" call assert_equal(["0b11111111111111111111111111111111"], getline(1, '$')) call assert_equal([0, 1, 1, 0], getpos('.')) + set nrformats-=alpha endfunc " 27) increment with 'rightreft', if supported @@ -575,4 +576,25 @@ func Test_visual_increment_27() endif endfunc +" 28) block-wise increment and dot-repeat +" Text: +" 1 23 +" 4 56 +" +" Expected: +" 1) f2 Ctrl-V jl , repeat twice afterwards with . +" 1 26 +" 4 59 +" +" Try with and without indent. +func Test_visual_increment_28() + call setline(1, [" 1 23", " 4 56"]) + exec "norm! ggf2\jl\.." + call assert_equal([" 1 26", " 4 59"], getline(1, 2)) + + call setline(1, ["1 23", "4 56"]) + exec "norm! ggf2\jl\.." + call assert_equal(["1 26", "4 59"], getline(1, 2)) +endfunc + " vim: tabstop=2 shiftwidth=2 expandtab -- cgit From 40149a9dbf475ad1d0dec9a9494a32c26a6536ce Mon Sep 17 00:00:00 2001 From: watiko Date: Thu, 14 Jan 2016 12:43:07 +0900 Subject: vim-patch:7.4.634 Problem: Marks are not restored after redo + undo. Solution: Fix the way marks are restored. (Olaf Dabrunz) https://github.com/vim/vim/commit/f65aad5554f1d1f972f0bd38059da70e3cdf4c87 https://github.com/vim/vim/commit/35e7594dd429f7a8a06cefd61c3e8d48b9bd74e2 --- src/nvim/testdir/Makefile | 1 + src/nvim/testdir/test_marks.in | 18 ++++++++++++++++++ src/nvim/testdir/test_marks.ok | 6 ++++++ 3 files changed, 25 insertions(+) create mode 100644 src/nvim/testdir/test_marks.in create mode 100644 src/nvim/testdir/test_marks.ok (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index db8547753d..2d3dc98137 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -28,6 +28,7 @@ SCRIPTS := \ test_charsearch.out \ test_close_count.out \ test_command_count.out \ + test_marks.out \ NEW_TESTS = test_increment.res diff --git a/src/nvim/testdir/test_marks.in b/src/nvim/testdir/test_marks.in new file mode 100644 index 0000000000..341f3ac30f --- /dev/null +++ b/src/nvim/testdir/test_marks.in @@ -0,0 +1,18 @@ +Tests for marks. + +STARTTEST +:so small.vim +:" test that a deleted mark is restored after delete-undo-redo-undo +:/^\t/+1 +:set nocp viminfo+=nviminfo +madduu +:let a = string(getpos("'a")) +:$put ='Mark after delete-undo-redo-undo: '.a +:/^\t/,$wq! test.out +ENDTEST + + textline A + textline B + textline C + +Results: diff --git a/src/nvim/testdir/test_marks.ok b/src/nvim/testdir/test_marks.ok new file mode 100644 index 0000000000..dd1a3e43b5 --- /dev/null +++ b/src/nvim/testdir/test_marks.ok @@ -0,0 +1,6 @@ + textline A + textline B + textline C + +Results: +Mark after delete-undo-redo-undo: [0, 15, 2, 0] -- cgit From 3a94e06abbcc0dfff658b626891ec308f7582180 Mon Sep 17 00:00:00 2001 From: watiko Date: Thu, 14 Jan 2016 13:56:41 +0900 Subject: vim-patch:7.4.1085 Problem: The CTRL-A and CTRL-X commands do not update the '[ and '] marks. Solution: (Yukihiro Nakadaira) https://github.com/vim/vim/commit/a52dfaed104183c1fa2a3b6e4430b23d86bcbece --- src/nvim/testdir/test_marks.in | 18 +++++++++++++++++- src/nvim/testdir/test_marks.ok | 10 ++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_marks.in b/src/nvim/testdir/test_marks.in index 341f3ac30f..23c2fb65fe 100644 --- a/src/nvim/testdir/test_marks.in +++ b/src/nvim/testdir/test_marks.in @@ -8,11 +8,27 @@ STARTTEST madduu :let a = string(getpos("'a")) :$put ='Mark after delete-undo-redo-undo: '.a -:/^\t/,$wq! test.out +:'' ENDTEST textline A textline B textline C +STARTTEST +:" test that CTRL-A and CTRL-X updates last changed mark '[, ']. +:/^123/ +:execute "normal! \`[v`]rAjwvjw\`[v`]rX" +ENDTEST + +CTRL-A CTRL-X: +123 123 123 +123 123 123 +123 123 123 + +STARTTEST +:g/^STARTTEST/.,/^ENDTEST/d +:wq! test.out +ENDTEST + Results: diff --git a/src/nvim/testdir/test_marks.ok b/src/nvim/testdir/test_marks.ok index dd1a3e43b5..e6c02ee7b0 100644 --- a/src/nvim/testdir/test_marks.ok +++ b/src/nvim/testdir/test_marks.ok @@ -1,6 +1,16 @@ +Tests for marks. + + textline A textline B textline C + +CTRL-A CTRL-X: +AAA 123 123 +123 XXXXXXX +XXX 123 123 + + Results: Mark after delete-undo-redo-undo: [0, 15, 2, 0] -- cgit From 8f212568aa5083a77b3617f2cef5b438f3d90e42 Mon Sep 17 00:00:00 2001 From: watiko Date: Fri, 15 Jan 2016 21:04:06 +0900 Subject: vim-patch:7.4.1087 Problem: CTRL-A and CTRL-X do not work properly with blockwise visual selection if there is a mix of Tab and spaces. Solution: Add OP_NR_ADD and OP_NR_SUB. (Hirohito Higashi) https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e --- src/nvim/testdir/test_increment.vim | 110 +++++++++++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 3 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_increment.vim b/src/nvim/testdir/test_increment.vim index 51cc45f98d..e4f67eacad 100644 --- a/src/nvim/testdir/test_increment.vim +++ b/src/nvim/testdir/test_increment.vim @@ -133,7 +133,7 @@ func Test_visual_increment_04() exec "norm! vf-\" call assert_equal(["foobar-10"], getline(1, '$')) " NOTE: I think this is correct behavior... - "call assert_equal([0, 1, 1, 0], getpos('.')) + call assert_equal([0, 1, 1, 0], getpos('.')) endfunc " 5) g on letter @@ -576,7 +576,111 @@ func Test_visual_increment_27() endif endfunc -" 28) block-wise increment and dot-repeat +" Tab code and linewise-visual inc/dec +func Test_visual_increment_28() + call setline(1, ["x\10", "\-1"]) + exec "norm! Vj\" + call assert_equal(["x\11", "\0"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + call setline(1, ["x\10", "\-1"]) + exec "norm! ggVj\" + call assert_equal(["x\9", "\-2"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" Tab code and linewise-visual inc/dec with 'nrformats'+=alpha +func Test_visual_increment_29() + set nrformats+=alpha + call setline(1, ["x\10", "\-1"]) + exec "norm! Vj\" + call assert_equal(["y\10", "\0"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + call setline(1, ["x\10", "\-1"]) + exec "norm! ggVj\" + call assert_equal(["w\10", "\-2"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" Tab code and character-visual inc/dec +func Test_visual_increment_30() + call setline(1, ["x\10", "\-1"]) + exec "norm! f1vjf1\" + call assert_equal(["x\11", "\0"], getline(1, '$')) + call assert_equal([0, 1, 3, 0], getpos('.')) + + call setline(1, ["x\10", "\-1"]) + exec "norm! ggf1vjf1\" + call assert_equal(["x\9", "\-2"], getline(1, '$')) + call assert_equal([0, 1, 3, 0], getpos('.')) +endfunc + +" Tab code and blockwise-visual inc/dec +func Test_visual_increment_31() + call setline(1, ["x\10", "\-1"]) + exec "norm! f1\jl\" + call assert_equal(["x\11", "\0"], getline(1, '$')) + call assert_equal([0, 1, 3, 0], getpos('.')) + + call setline(1, ["x\10", "\-1"]) + exec "norm! ggf1\jl\" + call assert_equal(["x\9", "\-2"], getline(1, '$')) + call assert_equal([0, 1, 3, 0], getpos('.')) +endfunc + +" Tab code and blockwise-visual decrement with 'linebreak' and 'showbreak' +func Test_visual_increment_32() + 28vnew dummy_31 + set linebreak showbreak=+ + call setline(1, ["x\\\10", "\\\\-1"]) + exec "norm! ggf0\jg_\" + call assert_equal(["x\\\1-1", "\\\\-2"], getline(1, '$')) + call assert_equal([0, 1, 6, 0], getpos('.')) + bwipe! +endfunc + +" Tab code and blockwise-visual increment with $ +func Test_visual_increment_33() + call setline(1, ["\123", "456"]) + exec "norm! gg0\j$\" + call assert_equal(["\124", "457"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" Tab code and blockwise-visual increment and redo +func Test_visual_increment_34() + call setline(1, ["\123", " 456789"]) + exec "norm! gg0\j\" + call assert_equal(["\123", " 457789"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + exec "norm! .." + call assert_equal(["\123", " 459789"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" Tab code, spaces and character-visual increment and redo +func Test_visual_increment_35() + call setline(1, ["\123", " 123", "\123", "\123"]) + exec "norm! ggvjf3\..." + call assert_equal(["\127", " 127", "\123", "\123"], getline(1, '$')) + call assert_equal([0, 1, 2, 0], getpos('.')) +endfunc + +" Tab code, spaces and blockwise-visual increment and redo +func Test_visual_increment_36() + call setline(1, [" 123", "\456789"]) + exec "norm! G0\kl\" + call assert_equal([" 123", "\556789"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) + + exec "norm! ..." + call assert_equal([" 123", "\856789"], getline(1, '$')) + call assert_equal([0, 1, 1, 0], getpos('.')) +endfunc + +" block-wise increment and dot-repeat " Text: " 1 23 " 4 56 @@ -587,7 +691,7 @@ endfunc " 4 59 " " Try with and without indent. -func Test_visual_increment_28() +func Test_visual_increment_37() call setline(1, [" 1 23", " 4 56"]) exec "norm! ggf2\jl\.." call assert_equal([" 1 26", " 4 59"], getline(1, 2)) -- cgit From 2016365ffe3f791193ca5d58812ed56bdfc307e5 Mon Sep 17 00:00:00 2001 From: watiko Date: Fri, 15 Jan 2016 21:59:35 +0900 Subject: vim-patch:7.4.1089 Problem: Repeating CTRL-A doesn't work. Solution: Call prep_redo_cmd(). (Hirohito Higashi) https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d --- src/nvim/testdir/test_increment.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_increment.vim b/src/nvim/testdir/test_increment.vim index e4f67eacad..9b592edce4 100644 --- a/src/nvim/testdir/test_increment.vim +++ b/src/nvim/testdir/test_increment.vim @@ -701,4 +701,11 @@ func Test_visual_increment_37() call assert_equal(["1 26", "4 59"], getline(1, 2)) endfunc +" Check redo after the normal mode increment +func Test_visual_increment_38() + exec "norm! i10\5\." + call assert_equal(["20"], getline(1, '$')) + call assert_equal([0, 1, 2, 0], getpos('.')) +endfunc + " vim: tabstop=2 shiftwidth=2 expandtab -- cgit From fa924f460423897375a49f56901b925636dc17e2 Mon Sep 17 00:00:00 2001 From: watiko Date: Sat, 16 Jan 2016 00:44:55 +0900 Subject: tests: Migrate legacy test increment. --- src/nvim/testdir/Makefile | 2 +- src/nvim/testdir/test_increment.vim | 711 ------------------------------------ 2 files changed, 1 insertion(+), 712 deletions(-) delete mode 100644 src/nvim/testdir/test_increment.vim (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 2d3dc98137..fe511166f2 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -30,7 +30,7 @@ SCRIPTS := \ test_command_count.out \ test_marks.out \ -NEW_TESTS = test_increment.res +NEW_TESTS = SCRIPTS_GUI := test16.out diff --git a/src/nvim/testdir/test_increment.vim b/src/nvim/testdir/test_increment.vim deleted file mode 100644 index 9b592edce4..0000000000 --- a/src/nvim/testdir/test_increment.vim +++ /dev/null @@ -1,711 +0,0 @@ -" Tests for using Ctrl-A/Ctrl-X on visual selections - -func SetUp() - new dummy - set nrformats&vim -endfunc - -func TearDown() - bwipe! -endfunc - -" 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 -func Test_visual_increment_01() - call setline(1, repeat(["foobaar-10"], 5)) - - call cursor(1, 1) - exec "norm! \" - call assert_equal("foobaar-9", getline('.')) - call assert_equal([0, 1, 9, 0], getpos('.')) - - call cursor(2, 1) - exec "norm! f-v$\" - call assert_equal("foobaar-9", getline('.')) - call assert_equal([0, 2, 8, 0], getpos('.')) - - call cursor(3, 1) - exec "norm! f1v$\" - call assert_equal("foobaar-11", getline('.')) - call assert_equal([0, 3, 9, 0], getpos('.')) - - call cursor(4, 1) - exec "norm! f-v$\" - call assert_equal("foobaar-11", getline('.')) - call assert_equal([0, 4, 8, 0], getpos('.')) - - call cursor(5, 1) - exec "norm! f1v$\" - call assert_equal("foobaar-9", getline('.')) - call assert_equal([0, 5, 9, 0], getpos('.')) -endfunc - -" 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 -func Test_visual_increment_02() - call setline(1, ["10", "20", "30", "40"]) - exec "norm! GV3k$\" - call assert_equal(["11", "21", "31", "41"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) - - call setline(1, ["10", "20", "30", "40"]) - exec "norm! GV3k$\" - call assert_equal(["9", "19", "29", "39"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 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 -func Test_visual_increment_03() - call setline(1, ["10", "", "20", "", "30", "", "40"]) - exec "norm! GV6k2g\" - call assert_equal(["12", "", "24", "", "36", "", "48"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) - - call setline(1, ["10", "", "20", "", "30", "", "40"]) - exec "norm! GV6k2g\" - call assert_equal(["8", "", "16", "", "24", "", "32"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 4) Ctrl-A on non-number -" Text: -" foobar-10 -" Expected: -" 1) visually select foobar: -" foobar-10 -func Test_visual_increment_04() - call setline(1, ["foobar-10"]) - exec "norm! vf-\" - call assert_equal(["foobar-10"], getline(1, '$')) - " NOTE: I think this is correct behavior... - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 5) g on letter -" Test: -" a -" a -" a -" a -" Expected: -" 1) g Ctrl-A on visually selected lines -" b -" c -" d -" e -func Test_visual_increment_05() - set nrformats+=alpha - call setline(1, repeat(["a"], 4)) - exec "norm! GV3kg\" - call assert_equal(["b", "c", "d", "e"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 6) g on letter -" Test: -" z -" z -" z -" z -" Expected: -" 1) g Ctrl-X on visually selected lines -" y -" x -" w -" v -func Test_visual_increment_06() - set nrformats+=alpha - call setline(1, repeat(["z"], 4)) - exec "norm! GV3kg\" - call assert_equal(["y", "x", "w", "v"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 7) 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 -func Test_visual_increment_07() - call setline(1, ["2", "1", "0", "-1", "-2"]) - exec "norm! GV4k\" - call assert_equal(["3", "2", "1", "0", "-1"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) - - call setline(1, ["2", "1", "0", "-1", "-2"]) - exec "norm! GV4k\" - call assert_equal(["1", "0", "-1", "-2", "-3"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 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 -func Test_visual_increment_08() - call setline(1, repeat(["0x9"], 2)) - exec "norm! \j$\" - call assert_equal(["0xa", "0xa"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) - - call setline(1, repeat(["0x9"], 2)) - exec "norm! gg$\+\" - call assert_equal(["0xa", "0xa"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 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 -func Test_visual_increment_09() - call setline(1, ["2", "2", "", "3", "3", ""]) - exec "norm! ggVj2\" - call assert_equal(["4", "4", "", "3", "3", ""], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) - - exec "norm! 3j." - call assert_equal(["4", "4", "", "5", "5", ""], getline(1, '$')) - call assert_equal([0, 4, 1, 0], getpos('.')) -endfunc - -" 10) sequentially decrement 1 -" Text: -" 1 -" 1 -" 1 -" 1 -" Expected: -" 1) g Ctrl-X on visually selected lines -" 0 -" -1 -" -2 -" -3 -func Test_visual_increment_10() - call setline(1, repeat(["1"], 4)) - exec "norm! GV3kg\" - call assert_equal(["0", "-1", "-2", "-3"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 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 -func Test_visual_increment_11() - call setline(1, [" 1", "1", " 1", " 1"]) - exec "norm! f1\3jg\" - call assert_equal([" 2", "1", " 3", " 4"], getline(1, '$')) - call assert_equal([0, 1, 5, 0], getpos('.')) -endfunc - -" 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 -func Test_visual_increment_12() - call setline(1, repeat(["0 0"], 3)) - exec "norm! $v++\" - call assert_equal(["0 1", "1 0", "1 0"], getline(1, '$')) - call assert_equal([0, 1, 3, 0], getpos('.')) -endfunc - -" 13) visually selected part of columns -" Text: -" max: 100px -" max: 200px -" max: 300px -" max: 400px -" Expected: -" 1) 'v' on first two numbers Ctrl-A -" max: 110px -" max: 220px -" max: 330px -" max: 400px -" 2) 'v' on first two numbers Ctrl-X -" max: 90px -" max: 190px -" max: 290px -" max: 400px -func Test_visual_increment_13() - call setline(1, ["max: 100px", "max: 200px", "max: 300px", "max: 400px"]) - exec "norm! f1\l2j\" - call assert_equal(["max: 110px", "max: 210px", "max: 310px", "max: 400px"], getline(1, '$')) - call assert_equal([0, 1, 6, 0], getpos('.')) - - call setline(1, ["max: 100px", "max: 200px", "max: 300px", "max: 400px"]) - exec "norm! ggf1\l2j\" - call assert_equal(["max: 90px", "max: 190px", "max: 290px", "max: 400px"], getline(1, '$')) - call assert_equal([0, 1, 6, 0], getpos('.')) -endfunc - -" 14) redo in block mode -" Text: -" 1 1 -" 1 1 -" Expected: -" 1) Ctrl-a on first column, redo on second column -" 2 2 -" 2 2 -func Test_visual_increment_14() - call setline(1, repeat(["1 1"], 2)) - exec "norm! G\k\w." - call assert_equal(["2 2", "2 2"], getline(1, '$')) - call assert_equal([0, 1, 3, 0], getpos('.')) -endfunc - -" 15) block select single numbers -" Text: -" 101 -" Expected: -" 1) Ctrl-a on visually selected zero -" 111 -func Test_visual_increment_15() - call setline(1, ["101"]) - exec "norm! lv\" - call assert_equal(["111"], getline(1, '$')) - call assert_equal([0, 1, 2, 0], getpos('.')) -endfunc - -" 16) increment right aligned numbers -" Text: -" 1 -" 19 -" 119 -" Expected: -" 1) Ctrl-a on line selected region -" 2 -" 20 -" 120 -func Test_visual_increment_16() - call setline(1, [" 1", " 19", " 119"]) - exec "norm! VG\" - call assert_equal([" 2", " 20", " 120"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 17) block-wise increment and redo -" Text: -" 100 -" 1 -" -" 100 -" 1 -" -" Expected: -" 1) Ctrl-V j $ on first block, afterwards '.' on second -" 101 -" 2 -" -" 101 -" 2 -func Test_visual_increment_17() - call setline(1, [" 100", " 1", "", " 100", " 1"]) - exec "norm! \j$\2j." - call assert_equal([" 101", " 2", "", " 101", " 1"], getline(1, '$')) - call assert_equal([0, 3, 1, 0], getpos('.')) -endfunc - -" 18) repeat of g -" Text: -" 0 -" 0 -" 0 -" 0 -" -" Expected: -" 1) V 4j g, repeat twice afterwards with . -" 3 -" 6 -" 9 -" 12 -func Test_visual_increment_18() - call setline(1, repeat(["0"], 4)) - exec "norm! GV3kg\" - exec "norm! .." - call assert_equal(["3", "6", "9", "12"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 19) increment on number with nrformat including alpha -" Text: -" 1 -" 1a -" -" Expected: -" 1) j$ -" 2 -" 2a -func Test_visual_increment_19() - set nrformats+=alpha - call setline(1, ["1", "1a"]) - exec "norm! \G$\" - call assert_equal(["2", "2a"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 20) increment a single letter -" Text: -" a -" -" Expected: -" 1) and cursor is on a -" b -func Test_visual_increment_20() - set nrformats+=alpha - call setline(1, ["a"]) - exec "norm! \" - call assert_equal(["b"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 21) block-wise increment on part of hexadecimal -" Text: -" 0x123456 -" -" Expected: -" 1) Ctrl-V f3 -" 0x124456 -func Test_visual_increment_21() - call setline(1, ["0x123456"]) - exec "norm! \f3\" - call assert_equal(["0x124456"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 22) Block increment on 0b0 -" Text: -" 0b1 -" 0b1 -" Expected: -" 1) Ctrl-A on visually block selected region (cursor at beginning): -" 0b10 -" 0b10 -" 2) Ctrl-A on visually block selected region (cursor at end) -" 0b10 -" 0b10 -func Test_visual_increment_22() - call setline(1, repeat(["0b1"], 2)) - exec "norm! \j$\" - call assert_equal(repeat(["0b10"], 2), getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) - - call setline(1, repeat(["0b1"], 2)) - exec "norm! $\+\" - call assert_equal(repeat(["0b10"], 2), getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 23) block-wise increment on part of binary -" Text: -" 0b1001 -" -" Expected: -" 1) Ctrl-V 5l -" 0b1011 -func Test_visual_increment_23() - call setline(1, ["0b1001"]) - exec "norm! \4l\" - call assert_equal(["0b1011"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 24) increment hexadecimal -" Text: -" 0x0b1001 -" -" Expected: -" 1) -" 0x0b1002 -func Test_visual_increment_24() - call setline(1, ["0x0b1001"]) - exec "norm! \$\" - call assert_equal(["0x0b1002"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 25) increment binary with nrformats including alpha -" Text: -" 0b1001a -" -" Expected: -" 1) -" 0b1010a -func Test_visual_increment_25() - set nrformats+=alpha - call setline(1, ["0b1001a"]) - exec "norm! \$\" - call assert_equal(["0b1010a"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" 26) increment binary with 32 bits -" Text: -" 0b11111111111111111111111111111110 -" -" Expected: -" 1) -" 0b11111111111111111111111111111111 -func Test_visual_increment_26() - set nrformats+=alpha - call setline(1, ["0b11111111111111111111111111111110"]) - exec "norm! \$\" - call assert_equal(["0b11111111111111111111111111111111"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) - set nrformats-=alpha -endfunc - -" 27) increment with 'rightreft', if supported -func Test_visual_increment_27() - if exists('+rightleft') - set rightleft - call setline(1, ["1234 56"]) - - exec "norm! $\" - call assert_equal(["1234 57"], getline(1, '$')) - call assert_equal([0, 1, 7, 0], getpos('.')) - - exec "norm! \" - call assert_equal(["1234 58"], getline(1, '$')) - call assert_equal([0, 1, 7, 0], getpos('.')) - set norightleft - endif -endfunc - -" Tab code and linewise-visual inc/dec -func Test_visual_increment_28() - call setline(1, ["x\10", "\-1"]) - exec "norm! Vj\" - call assert_equal(["x\11", "\0"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) - - call setline(1, ["x\10", "\-1"]) - exec "norm! ggVj\" - call assert_equal(["x\9", "\-2"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" Tab code and linewise-visual inc/dec with 'nrformats'+=alpha -func Test_visual_increment_29() - set nrformats+=alpha - call setline(1, ["x\10", "\-1"]) - exec "norm! Vj\" - call assert_equal(["y\10", "\0"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) - - call setline(1, ["x\10", "\-1"]) - exec "norm! ggVj\" - call assert_equal(["w\10", "\-2"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" Tab code and character-visual inc/dec -func Test_visual_increment_30() - call setline(1, ["x\10", "\-1"]) - exec "norm! f1vjf1\" - call assert_equal(["x\11", "\0"], getline(1, '$')) - call assert_equal([0, 1, 3, 0], getpos('.')) - - call setline(1, ["x\10", "\-1"]) - exec "norm! ggf1vjf1\" - call assert_equal(["x\9", "\-2"], getline(1, '$')) - call assert_equal([0, 1, 3, 0], getpos('.')) -endfunc - -" Tab code and blockwise-visual inc/dec -func Test_visual_increment_31() - call setline(1, ["x\10", "\-1"]) - exec "norm! f1\jl\" - call assert_equal(["x\11", "\0"], getline(1, '$')) - call assert_equal([0, 1, 3, 0], getpos('.')) - - call setline(1, ["x\10", "\-1"]) - exec "norm! ggf1\jl\" - call assert_equal(["x\9", "\-2"], getline(1, '$')) - call assert_equal([0, 1, 3, 0], getpos('.')) -endfunc - -" Tab code and blockwise-visual decrement with 'linebreak' and 'showbreak' -func Test_visual_increment_32() - 28vnew dummy_31 - set linebreak showbreak=+ - call setline(1, ["x\\\10", "\\\\-1"]) - exec "norm! ggf0\jg_\" - call assert_equal(["x\\\1-1", "\\\\-2"], getline(1, '$')) - call assert_equal([0, 1, 6, 0], getpos('.')) - bwipe! -endfunc - -" Tab code and blockwise-visual increment with $ -func Test_visual_increment_33() - call setline(1, ["\123", "456"]) - exec "norm! gg0\j$\" - call assert_equal(["\124", "457"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" Tab code and blockwise-visual increment and redo -func Test_visual_increment_34() - call setline(1, ["\123", " 456789"]) - exec "norm! gg0\j\" - call assert_equal(["\123", " 457789"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) - - exec "norm! .." - call assert_equal(["\123", " 459789"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" Tab code, spaces and character-visual increment and redo -func Test_visual_increment_35() - call setline(1, ["\123", " 123", "\123", "\123"]) - exec "norm! ggvjf3\..." - call assert_equal(["\127", " 127", "\123", "\123"], getline(1, '$')) - call assert_equal([0, 1, 2, 0], getpos('.')) -endfunc - -" Tab code, spaces and blockwise-visual increment and redo -func Test_visual_increment_36() - call setline(1, [" 123", "\456789"]) - exec "norm! G0\kl\" - call assert_equal([" 123", "\556789"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) - - exec "norm! ..." - call assert_equal([" 123", "\856789"], getline(1, '$')) - call assert_equal([0, 1, 1, 0], getpos('.')) -endfunc - -" block-wise increment and dot-repeat -" Text: -" 1 23 -" 4 56 -" -" Expected: -" 1) f2 Ctrl-V jl , repeat twice afterwards with . -" 1 26 -" 4 59 -" -" Try with and without indent. -func Test_visual_increment_37() - call setline(1, [" 1 23", " 4 56"]) - exec "norm! ggf2\jl\.." - call assert_equal([" 1 26", " 4 59"], getline(1, 2)) - - call setline(1, ["1 23", "4 56"]) - exec "norm! ggf2\jl\.." - call assert_equal(["1 26", "4 59"], getline(1, 2)) -endfunc - -" Check redo after the normal mode increment -func Test_visual_increment_38() - exec "norm! i10\5\." - call assert_equal(["20"], getline(1, '$')) - call assert_equal([0, 1, 2, 0], getpos('.')) -endfunc - -" vim: tabstop=2 shiftwidth=2 expandtab -- cgit