1
0
forked from aniani/vim

patch 8.2.2916: operators are not fully tested

Problem:    Operators are not fully tested.
Solution:   Add a few more tests. (Yegappan Lakshmanan, closes #8290)
This commit is contained in:
Yegappan Lakshmanan
2021-05-31 19:23:01 +02:00
committed by Bram Moolenaar
parent ef8706fb84
commit 2ac7184d34
5 changed files with 166 additions and 1 deletions

View File

@@ -3377,4 +3377,34 @@ func Test_normal_shift_rightleft()
bw!
endfunc
" Some commands like yy, cc, dd, >>, << and !! accept a count after
" typing the first letter of the command.
func Test_normal_count_after_operator()
new
setlocal shiftwidth=4 tabstop=8 autoindent
call setline(1, ['one', 'two', 'three', 'four', 'five'])
let @a = ''
normal! j"ay4y
call assert_equal("two\nthree\nfour\nfive\n", @a)
normal! 3G>2>
call assert_equal(['one', 'two', ' three', ' four', 'five'],
\ getline(1, '$'))
exe "normal! 3G0c2cred\nblue"
call assert_equal(['one', 'two', ' red', ' blue', 'five'],
\ getline(1, '$'))
exe "normal! gg<8<"
call assert_equal(['one', 'two', 'red', 'blue', 'five'],
\ getline(1, '$'))
exe "normal! ggd3d"
call assert_equal(['blue', 'five'], getline(1, '$'))
call setline(1, range(1, 4))
call feedkeys("gg!3!\<C-B>\"\<CR>", 'xt')
call assert_equal('".,.+2!', @:)
call feedkeys("gg!1!\<C-B>\"\<CR>", 'xt')
call assert_equal('".!', @:)
call feedkeys("gg!9!\<C-B>\"\<CR>", 'xt')
call assert_equal('".,$!', @:)
bw!
endfunc
" vim: shiftwidth=2 sts=2 expandtab