From d6711685747681e006f996893e85c998d192b2eb Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 14 Jul 2018 02:04:42 -0400 Subject: vim-patch:8.0.0890: still many old style tests Problem: Still many old style tests. Solution: Convert several tests to new style. (Yegappan Lakshmanan) https://github.com/vim/vim/commit/75373f38087dd756babdbbf9f14fd4711712c5de --- src/nvim/testdir/test_visual.vim | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/nvim/testdir/test_visual.vim') diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim index 0f2e7e493e..0be6ebd02d 100644 --- a/src/nvim/testdir/test_visual.vim +++ b/src/nvim/testdir/test_visual.vim @@ -152,3 +152,34 @@ func Test_virtual_replace() \ 'AB IJKLMNO QRst'], getline(12, 13)) enew! endfunc + +" Test for Visual mode not being reset causing E315 error. +func TriggerTheProblem() + " At this point there is no visual selection because :call reset it. + " Let's restore the selection: + normal gv + '<,'>del _ + try + exe "normal \" + catch /^Vim\%((\a\+)\)\=:E315/ + echom 'Snap! E315 error!' + let g:msg='Snap! E315 error!' + endtry +endfunc + +func Test_visual_mode_reset() + set belloff=all + enew + let g:msg="Everything's fine." + enew + setl buftype=nofile + call append(line('$'), 'Delete this line.') + + " NOTE: this has to be done by a call to a function because executing :del + " the ex-way will require the colon operator which resets the visual mode + " thus preventing the problem: + exe "normal! GV:call TriggerTheProblem()\" + call assert_equal("Everything's fine.", g:msg) + + set belloff& +endfunc -- cgit From 7f2e3527007580e6885b0fd6253aefba13e74a60 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 14 Jul 2018 18:03:20 -0400 Subject: vim-patch:8.0.0879: crash when shifting with huge number Problem: Crash when shifting with huge number. Solution: Check for overflow. (Dominique Pelle, closes vim/vim#1945) https://github.com/vim/vim/commit/bae5a17a738d1a3b5c51d9aa5d99e228d3911955 --- src/nvim/testdir/test_visual.vim | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/nvim/testdir/test_visual.vim') diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim index 0be6ebd02d..6520666d45 100644 --- a/src/nvim/testdir/test_visual.vim +++ b/src/nvim/testdir/test_visual.vim @@ -17,6 +17,14 @@ func Test_block_shift_multibyte() q! endfunc +func Test_block_shift_overflow() + " This used to cause a multiplication overflow followed by a crash. + new + normal ii + exe "normal \876543210>" + q! +endfunc + func Test_Visual_ctrl_o() new call setline(1, ['one', 'two', 'three']) -- cgit From f53c2578e79877376259390840ccce56963251c4 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 14 Jul 2018 18:32:40 -0400 Subject: vim-patch:8.0.1575: crash when using virtual replace Problem: Crash when using virtual replace. Solution: Adjust orig_line_count. Add more tests. (Christian Brabandt) https://github.com/vim/vim/commit/63e82db6fc910b2d8f1cd018894e50e8b4448155 --- src/nvim/testdir/test_visual.vim | 59 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) (limited to 'src/nvim/testdir/test_visual.vim') diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim index 6520666d45..fb868e09a5 100644 --- a/src/nvim/testdir/test_visual.vim +++ b/src/nvim/testdir/test_visual.vim @@ -159,6 +159,61 @@ func Test_virtual_replace() call assert_equal(['AB......CDEFGHI.Jkl', \ 'AB IJKLMNO QRst'], getline(12, 13)) enew! + set noai bs&vim t_kD&vim t_kb&vim +endfunc + +" Test Virtual replace mode. +func Test_virtual_replace2() + enew! + set bs=2 + exe "normal a\nabcdefghi\njk\tlmn\n opq rst\n\uvwxyz" + call cursor(1,1) + " Test 1: Test that del deletes the newline + exe "normal gR0\ 1\nA\nBCDEFGHIJ\n\tKL\nMNO\nPQR" + call assert_equal(['0 1', + \ 'A', + \ 'BCDEFGHIJ', + \ ' KL', + \ 'MNO', + \ 'PQR', + \ ], getline(1, 6)) + " Test 2: + " a newline is not deleted, if no newline has been added in virtual replace mode + %d_ + call setline(1, ['abcd', 'efgh', 'ijkl']) + call cursor(2,1) + exe "norm! gR1234\5\\\" + call assert_equal(['abcd', + \ '123h', + \ 'ijkl'], getline(1, '$')) + " Test 3: + " a newline is deleted, if a newline has been inserted before in virtual replace mode + %d_ + call setline(1, ['abcd', 'efgh', 'ijkl']) + call cursor(2,1) + exe "norm! gR1234\\56\\\" + call assert_equal(['abcd', + \ '1234', + \ 'ijkl'], getline(1, '$')) + " Test 4: + " delete add a newline, delete it, add it again and check undo + %d_ + call setline(1, ['abcd', 'efgh', 'ijkl']) + call cursor(2,1) + " break undo sequence explicitly + let &ul = &ul + exe "norm! gR1234\\\56\" + let &ul = &ul + call assert_equal(['abcd', + \ '123456', + \ ''], getline(1, '$')) + norm! u + call assert_equal(['abcd', + \ 'efgh', + \ 'ijkl'], getline(1, '$')) + " clean up + %d_ + set bs&vim endfunc " Test for Visual mode not being reset causing E315 error. @@ -171,14 +226,14 @@ func TriggerTheProblem() exe "normal \" catch /^Vim\%((\a\+)\)\=:E315/ echom 'Snap! E315 error!' - let g:msg='Snap! E315 error!' + let g:msg = 'Snap! E315 error!' endtry endfunc func Test_visual_mode_reset() set belloff=all enew - let g:msg="Everything's fine." + let g:msg = "Everything's fine." enew setl buftype=nofile call append(line('$'), 'Delete this line.') -- cgit From 62424fe6ee540d9da3becdebca7b5aaf4f958c71 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 14 Jul 2018 18:37:31 -0400 Subject: vim-patch:8.0.1577: virtual replace test fails on MS-Windows Problem: Virtual replace test fails on MS-Windows. Solution: Make adding a termcap entry work for a builtin terminal. Restore terminal keys in a better way. https://github.com/vim/vim/commit/e7808481507b9e11ae73c8f865e95eb2d20f6cc8 --- src/nvim/testdir/test_visual.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir/test_visual.vim') diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim index fb868e09a5..56eab7ec07 100644 --- a/src/nvim/testdir/test_visual.vim +++ b/src/nvim/testdir/test_visual.vim @@ -129,6 +129,8 @@ endfunc " Test Virtual replace mode. func Test_virtual_replace() throw 'skipped: TODO: ' + let save_t_kD = &t_kD + let save_t_kb = &t_kb exe "set t_kD=\x7f t_kb=\x08" enew! exe "normal a\nabcdefghi\njk\tlmn\n opq rst\n\uvwxyz" @@ -159,7 +161,9 @@ func Test_virtual_replace() call assert_equal(['AB......CDEFGHI.Jkl', \ 'AB IJKLMNO QRst'], getline(12, 13)) enew! - set noai bs&vim t_kD&vim t_kb&vim + set noai bs&vim + let &t_kD = save_t_kD + let &t_kb = save_t_kb endfunc " Test Virtual replace mode. -- cgit From ce5d7550488cacb2e783f350d007d6716ca7d1c6 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 14 Jul 2018 18:39:29 -0400 Subject: vim-patch:8.0.1579: virtual replace test fails in GUI Problem: Virtual replace test fails in GUI. Solution: Don't save key options if they were not set. https://github.com/vim/vim/commit/df0d24b62742edd3ea73795b96a771501e642970 --- src/nvim/testdir/test_visual.vim | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/nvim/testdir/test_visual.vim') diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim index 56eab7ec07..7d7ff75cfc 100644 --- a/src/nvim/testdir/test_visual.vim +++ b/src/nvim/testdir/test_visual.vim @@ -129,8 +129,12 @@ endfunc " Test Virtual replace mode. func Test_virtual_replace() throw 'skipped: TODO: ' - let save_t_kD = &t_kD - let save_t_kb = &t_kb + if exists('&t_kD') + let save_t_kD = &t_kD + endif + if exists('&t_kb') + let save_t_kb = &t_kb + endif exe "set t_kD=\x7f t_kb=\x08" enew! exe "normal a\nabcdefghi\njk\tlmn\n opq rst\n\uvwxyz" @@ -162,8 +166,12 @@ func Test_virtual_replace() \ 'AB IJKLMNO QRst'], getline(12, 13)) enew! set noai bs&vim - let &t_kD = save_t_kD - let &t_kb = save_t_kb + if exists('save_t_kD') + let &t_kD = save_t_kD + endif + if exists('save_t_kb') + let &t_kb = save_t_kb + endif endfunc " Test Virtual replace mode. -- cgit From f807a7de04f6bca409bb9a1b2b07f53a90afb25c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 24 Jul 2018 16:18:16 -0400 Subject: vim-patch:8.1.0007: no test for "o" and "O" in Visual block mode Problem: No test for "o" and "O" in Visual block mode. Solution: Add a test. (Dominique Pelle, closes vim/vim#2932) https://github.com/vim/vim/commit/2e94976abd1cd6b94db38d4f2a1cfd71808b8100 --- src/nvim/testdir/test_visual.vim | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/nvim/testdir/test_visual.vim') diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim index 7d7ff75cfc..756a455ebd 100644 --- a/src/nvim/testdir/test_visual.vim +++ b/src/nvim/testdir/test_visual.vim @@ -126,6 +126,25 @@ func Test_blockwise_visual() enew! endfunc +" Test swapping corners in blockwise visual mode with o and O +func Test_blockwise_visual_o_O() + enew! + + exe "norm! 10i.\Y4P3lj\4l2jr " + exe "norm! gvO\ra" + exe "norm! gvO\rb" + exe "norm! gvo\rc" + exe "norm! gvO\rd" + + call assert_equal(['..........', + \ '...c d..', + \ '... ..', + \ '...a b..', + \ '..........'], getline(1, '$')) + + enew! +endfun + " Test Virtual replace mode. func Test_virtual_replace() throw 'skipped: TODO: ' -- cgit