forked from aniani/vim
patch 8.2.0369: various Normal mode commands not fully tested
Problem: Various Normal mode commands not fully tested. Solution: Add more tests. (Yegappan Lakshmanan, closes #5751)
This commit is contained in:
@@ -281,7 +281,7 @@ func Test_edit_11()
|
||||
call cursor(2, 1)
|
||||
call feedkeys("i\<c-f>int c;\<esc>", 'tnix')
|
||||
call cursor(3, 1)
|
||||
call feedkeys("i/* comment */", 'tnix')
|
||||
call feedkeys("\<Insert>/* comment */", 'tnix')
|
||||
call assert_equal(['{', "\<tab>int c;", "/* comment */"], getline(1, '$'))
|
||||
" added changed cindentkeys slightly
|
||||
set cindent cinkeys+=*/
|
||||
@@ -1267,16 +1267,6 @@ func Test_edit_forbidden()
|
||||
catch /^Vim\%((\a\+)\)\=:E117/ " catch E117: unknown function
|
||||
endtry
|
||||
au! InsertCharPre
|
||||
" Not allowed to enter ex mode when text is locked
|
||||
au InsertCharPre <buffer> :normal! gQ<CR>
|
||||
let caught_e523 = 0
|
||||
try
|
||||
call feedkeys("ix\<esc>", 'xt')
|
||||
catch /^Vim\%((\a\+)\)\=:E523/ " catch E523
|
||||
let caught_e523 = 1
|
||||
endtry
|
||||
call assert_equal(1, caught_e523)
|
||||
au! InsertCharPre
|
||||
" 3) edit when completion is shown
|
||||
fun! Complete(findstart, base)
|
||||
if a:findstart
|
||||
@@ -1550,4 +1540,36 @@ func Test_edit_noesckeys()
|
||||
set esckeys
|
||||
endfunc
|
||||
|
||||
" Test for running an invalid ex command in insert mode using CTRL-O
|
||||
" Note that vim has a hard-coded sleep of 3 seconds. So this test will take
|
||||
" more than 3 seconds to complete.
|
||||
func Test_edit_ctrl_o_invalid_cmd()
|
||||
new
|
||||
set showmode showcmd
|
||||
let caught_e492 = 0
|
||||
try
|
||||
call feedkeys("i\<C-O>:invalid\<CR>abc\<Esc>", "xt")
|
||||
catch /E492:/
|
||||
let caught_e492 = 1
|
||||
endtry
|
||||
call assert_equal(1, caught_e492)
|
||||
call assert_equal('abc', getline(1))
|
||||
set showmode& showcmd&
|
||||
close!
|
||||
endfunc
|
||||
|
||||
" Test for inserting text at the beginning of a line
|
||||
func Test_insert_before_first_nonblank()
|
||||
new
|
||||
call setline(1, ' ')
|
||||
normal! Ia
|
||||
call assert_equal(' a', getline(1))
|
||||
set cpo+=H
|
||||
call setline(1, ' ')
|
||||
normal! Ia
|
||||
call assert_equal(' a ', getline(1))
|
||||
set cpo-=H
|
||||
close!
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
Reference in New Issue
Block a user