vim-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 vim/vim#7073)
d1ad99b654

Cherry-pick test_registers.vim change from patch 8.2.0644.
This commit is contained in:
zeertzjq
2022-07-20 08:16:02 +08:00
parent 37586eac42
commit 76b4b1977b
7 changed files with 136 additions and 22 deletions

View File

@@ -642,12 +642,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 _
@@ -1195,15 +1189,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)