diff options
| author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-06-11 21:07:47 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-11 21:07:47 -0400 |
| commit | d09b8ad715ca327766ed9f32c45e1776dae679f4 (patch) | |
| tree | 1137d78266238d2e3de42c3f1fbca8107c57e8f3 /src/nvim/testdir | |
| parent | a9b8c780fe3b74cec12747101e351ba7d13451f1 (diff) | |
| parent | 2644fe5b7c7dd0381543da56b9444bda79f14676 (diff) | |
| download | rneovim-d09b8ad715ca327766ed9f32c45e1776dae679f4.tar.gz rneovim-d09b8ad715ca327766ed9f32c45e1776dae679f4.tar.bz2 rneovim-d09b8ad715ca327766ed9f32c45e1776dae679f4.zip | |
Merge pull request #14761 from janlazo/vim-8.2.2966
vim-patch:8.2.{1702,2422,2966,2971,2974}
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_ex_mode.vim | 19 | ||||
| -rw-r--r-- | src/nvim/testdir/test_fold.vim | 20 | ||||
| -rw-r--r-- | src/nvim/testdir/test_visual.vim | 55 |
3 files changed, 94 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_ex_mode.vim b/src/nvim/testdir/test_ex_mode.vim index f70cb261e0..1c645ad0f8 100644 --- a/src/nvim/testdir/test_ex_mode.vim +++ b/src/nvim/testdir/test_ex_mode.vim @@ -1,5 +1,8 @@ " Test editing line in Ex mode (see :help Q and :help gQ). +source check.vim +source shared.vim + " Helper function to test editing line in Q Ex mode func Ex_Q(cmd) " Is there a simpler way to test editing Ex line? @@ -79,4 +82,20 @@ func Test_ex_mode_errors() quit endfunc +func Test_ex_mode_count_overflow() + " this used to cause a crash + let lines =<< trim END + call feedkeys("\<Esc>Q\<CR>") + v9|9silent! vi|333333233333y32333333%O + call writefile(['done'], 'Xdidexmode') + qall! + END + call writefile(lines, 'Xexmodescript') + call assert_equal(1, RunVim([], [], '-e -s -S Xexmodescript -c qa')) + call assert_equal(['done'], readfile('Xdidexmode')) + + call delete('Xdidexmode') + call delete('Xexmodescript') +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_fold.vim b/src/nvim/testdir/test_fold.vim index fcdf888b96..2cc5b47cb0 100644 --- a/src/nvim/testdir/test_fold.vim +++ b/src/nvim/testdir/test_fold.vim @@ -796,6 +796,26 @@ func Test_fold_delete_first_line() set foldmethod& endfunc +func Test_undo_fold_deletion() + new + set fdm=marker + let lines =<< trim END + " {{{ + " }}}1 + " {{{ + END + call setline(1, lines) + 3d + g/"/d + undo + redo + " eval getline(1, '$')->assert_equal(['']) + eval assert_equal(getline(1, '$'), ['']) + + set fdm&vim + bwipe! +endfunc + " this was crashing func Test_move_no_folds() new diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim index 21fd57b791..a40b0236e0 100644 --- a/src/nvim/testdir/test_visual.vim +++ b/src/nvim/testdir/test_visual.vim @@ -1006,4 +1006,59 @@ func Test_visual_put_in_block_using_zp() bwipe! endfunc +func Test_visual_put_in_block_using_zy_and_zp() + new + + " Test 1) Paste using zp - after the cursor without trailing spaces + call setline(1, ['/path;text', '/path;text', '/path;text', '', + \ 'texttext /subdir columntext', + \ 'texttext /longsubdir columntext', + \ 'texttext /longlongsubdir columntext']) + exe "normal! 5G0f/\<c-v>2jezy" + norm! 1G0f;hzp + call assert_equal(['/path/subdir;text', '/path/longsubdir;text', '/path/longlongsubdir;text'], getline(1, 3)) + + " Test 2) Paste using zP - in front of the cursor without trailing spaces + %d + call setline(1, ['/path;text', '/path;text', '/path;text', '', + \ 'texttext /subdir columntext', + \ 'texttext /longsubdir columntext', + \ 'texttext /longlongsubdir columntext']) + exe "normal! 5G0f/\<c-v>2jezy" + norm! 1G0f;zP + call assert_equal(['/path/subdir;text', '/path/longsubdir;text', '/path/longlongsubdir;text'], getline(1, 3)) + + " Test 3) Paste using p - with trailing spaces + %d + call setline(1, ['/path;text', '/path;text', '/path;text', '', + \ 'texttext /subdir columntext', + \ 'texttext /longsubdir columntext', + \ 'texttext /longlongsubdir columntext']) + exe "normal! 5G0f/\<c-v>2jezy" + norm! 1G0f;hp + call assert_equal(['/path/subdir ;text', '/path/longsubdir ;text', '/path/longlongsubdir;text'], getline(1, 3)) + + " Test 4) Paste using P - with trailing spaces + %d + call setline(1, ['/path;text', '/path;text', '/path;text', '', + \ 'texttext /subdir columntext', + \ 'texttext /longsubdir columntext', + \ 'texttext /longlongsubdir columntext']) + exe "normal! 5G0f/\<c-v>2jezy" + norm! 1G0f;P + call assert_equal(['/path/subdir ;text', '/path/longsubdir ;text', '/path/longlongsubdir;text'], getline(1, 3)) + + " Test 5) Yank with spaces inside the block + %d + call setline(1, ['/path;text', '/path;text', '/path;text', '', + \ 'texttext /sub dir/ columntext', + \ 'texttext /lon gsubdir/ columntext', + \ 'texttext /lon glongsubdir/ columntext']) + exe "normal! 5G0f/\<c-v>2jf/zy" + norm! 1G0f;zP + call assert_equal(['/path/sub dir/;text', '/path/lon gsubdir/;text', '/path/lon glongsubdir/;text'], getline(1, 3)) + bwipe! +endfunc + + " vim: shiftwidth=2 sts=2 expandtab |