0
0
mirror of https://github.com/vim/vim.git synced 2025-10-04 05:25:06 -04:00

patch 8.2.1799: some Normal mode commands not fully tested

Problem:    Some Normal mode commands not fully tested.
Solution:   Add a few more tests. (Yegappan Lakshmanan, closes #7073)
This commit is contained in:
Bram Moolenaar
2020-10-04 16:16:54 +02:00
parent 1310660557
commit d1ad99b654
8 changed files with 122 additions and 24 deletions

View File

@@ -1,5 +1,7 @@
" Tests for various Visual modes.
source shared.vim
func Test_block_shift_multibyte()
" Uses double-wide character.
split
@@ -636,12 +638,6 @@ func Test_characterwise_visual_mode()
normal Gkvj$d
call assert_equal(['', 'a', ''], getline(1, '$'))
" characterwise visual mode: use a count with the visual mode
%d _
call setline(1, 'one two three')
norm! vy5vy
call assert_equal('one t', @")
" characterwise visual mode: use a count with the visual mode from the last
" line in the buffer
%d _
@@ -905,15 +901,38 @@ func Test_exclusive_selection()
close!
endfunc
" Test for starting visual mode with a count.
" This test should be run without any previous visual modes. So this should be
" run as a first test.
func Test_AAA_start_visual_mode_with_count()
new
call setline(1, ['aaaaaaa', 'aaaaaaa', 'aaaaaaa', 'aaaaaaa'])
normal! gg2Vy
call assert_equal("aaaaaaa\naaaaaaa\n", @")
close!
" Test for starting linewise visual with a count.
" This test needs to be run without any previous visual mode. Otherwise the
" count will use the count from the previous visual mode.
func Test_linewise_visual_with_count()
let after =<< trim [CODE]
call setline(1, ['one', 'two', 'three', 'four'])
norm! 3Vy
call assert_equal("one\ntwo\nthree\n", @")
call writefile(v:errors, 'Xtestout')
qall!
[CODE]
if RunVim([], after, '')
call assert_equal([], readfile('Xtestout'))
call delete('Xtestout')
endif
endfunc
" Test for starting characterwise visual with a count.
" This test needs to be run without any previous visual mode. Otherwise the
" count will use the count from the previous visual mode.
func Test_characterwise_visual_with_count()
let after =<< trim [CODE]
call setline(1, ['one two', 'three'])
norm! l5vy
call assert_equal("ne tw", @")
call writefile(v:errors, 'Xtestout')
qall!
[CODE]
if RunVim([], after, '')
call assert_equal([], readfile('Xtestout'))
call delete('Xtestout')
endif
endfunc
" Test for visually selecting an inner block (iB)