vim-patch:8.2.2608: character input not fully tested

Problem:    Character input not fully tested.
Solution:   Add more tests. (Yegappan Lakshmanan, closes vim/vim#7963)
f4fcedc59d

Cherry-pick related changes from patches 8.2.{0433,0866}.
This commit is contained in:
zeertzjq
2022-07-16 21:39:05 +08:00
parent bc73795a58
commit 780edfc0eb
4 changed files with 66 additions and 8 deletions

View File

@@ -114,9 +114,7 @@ endfunc
" Test more-prompt (see :help more-prompt).
func Test_message_more()
if !CanRunVimInTerminal()
throw 'Skipped: cannot run vim in terminal'
endif
CheckRunVimInTerminal
let buf = RunVimInTerminal('', {'rows': 6})
call term_sendkeys(buf, ":call setline(1, range(1, 100))\n")
@@ -203,14 +201,22 @@ func Test_message_more()
call term_sendkeys(buf, 'q')
call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))})
call term_sendkeys(buf, ":q!\n")
" Execute a : command from the more prompt
call term_sendkeys(buf, ":%p#\n")
call term_wait(buf)
call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
call term_sendkeys(buf, ":")
call term_wait(buf)
call WaitForAssert({-> assert_equal(':', term_getline(buf, 6))})
call term_sendkeys(buf, "echo 'Hello'\n")
call term_wait(buf)
call WaitForAssert({-> assert_equal('Hello ', term_getline(buf, 5))})
call StopVimInTerminal(buf)
endfunc
func Test_ask_yesno()
if !CanRunVimInTerminal()
throw 'Skipped: cannot run vim in terminal'
endif
CheckRunVimInTerminal
let buf = RunVimInTerminal('', {'rows': 6})
call term_sendkeys(buf, ":call setline(1, range(1, 2))\n")
@@ -233,7 +239,6 @@ func Test_ask_yesno()
call WaitForAssert({-> assert_equal('y1', term_getline(buf, 1))})
call WaitForAssert({-> assert_equal('y2', term_getline(buf, 2))})
call term_sendkeys(buf, ":q!\n")
call StopVimInTerminal(buf)
endfunc

View File

@@ -684,6 +684,16 @@ func Test_insert_small_delete()
bwipe!
endfunc
" Record in insert mode using CTRL-O
func Test_record_in_insert_mode()
new
let @r = ''
call setline(1, ['foo'])
call feedkeys("i\<C-O>qrbaz\<C-O>q", 'xt')
call assert_equal('baz', @r)
bwipe!
endfunc
func Test_record_in_select_mode()
new
call setline(1, 'text')

View File

@@ -735,6 +735,20 @@ func Test_undofile_cryptmethod_blowfish2()
set undofile& undolevels& cryptmethod&
endfunc
" Test for redoing with incrementing numbered registers
func Test_redo_repeat_numbered_register()
new
for [i, v] in [[1, 'one'], [2, 'two'], [3, 'three'],
\ [4, 'four'], [5, 'five'], [6, 'six'],
\ [7, 'seven'], [8, 'eight'], [9, 'nine']]
exe 'let @' .. i .. '="' .. v .. '\n"'
endfor
call feedkeys('"1p.........', 'xt')
call assert_equal(['', 'one', 'two', 'three', 'four', 'five', 'six',
\ 'seven', 'eight', 'nine', 'nine'], getline(1, '$'))
bwipe!
endfunc
func Test_undo_mark()
new
" The undo is applied to the only line.