mirror of
https://github.com/neovim/neovim.git
synced 2025-10-02 16:08:36 +00:00
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:
@@ -114,9 +114,7 @@ endfunc
|
|||||||
|
|
||||||
" Test more-prompt (see :help more-prompt).
|
" Test more-prompt (see :help more-prompt).
|
||||||
func Test_message_more()
|
func Test_message_more()
|
||||||
if !CanRunVimInTerminal()
|
CheckRunVimInTerminal
|
||||||
throw 'Skipped: cannot run vim in terminal'
|
|
||||||
endif
|
|
||||||
let buf = RunVimInTerminal('', {'rows': 6})
|
let buf = RunVimInTerminal('', {'rows': 6})
|
||||||
call term_sendkeys(buf, ":call setline(1, range(1, 100))\n")
|
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 term_sendkeys(buf, 'q')
|
||||||
call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))})
|
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)
|
call StopVimInTerminal(buf)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_ask_yesno()
|
func Test_ask_yesno()
|
||||||
if !CanRunVimInTerminal()
|
CheckRunVimInTerminal
|
||||||
throw 'Skipped: cannot run vim in terminal'
|
|
||||||
endif
|
|
||||||
let buf = RunVimInTerminal('', {'rows': 6})
|
let buf = RunVimInTerminal('', {'rows': 6})
|
||||||
call term_sendkeys(buf, ":call setline(1, range(1, 2))\n")
|
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('y1', term_getline(buf, 1))})
|
||||||
call WaitForAssert({-> assert_equal('y2', term_getline(buf, 2))})
|
call WaitForAssert({-> assert_equal('y2', term_getline(buf, 2))})
|
||||||
|
|
||||||
call term_sendkeys(buf, ":q!\n")
|
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -684,6 +684,16 @@ func Test_insert_small_delete()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
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()
|
func Test_record_in_select_mode()
|
||||||
new
|
new
|
||||||
call setline(1, 'text')
|
call setline(1, 'text')
|
||||||
|
@@ -735,6 +735,20 @@ func Test_undofile_cryptmethod_blowfish2()
|
|||||||
set undofile& undolevels& cryptmethod&
|
set undofile& undolevels& cryptmethod&
|
||||||
endfunc
|
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()
|
func Test_undo_mark()
|
||||||
new
|
new
|
||||||
" The undo is applied to the only line.
|
" The undo is applied to the only line.
|
||||||
|
@@ -261,6 +261,35 @@ describe('messages', function()
|
|||||||
^100 |
|
^100 |
|
||||||
|
|
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
-- Execute a : command from the more prompt
|
||||||
|
feed(':%p#\n')
|
||||||
|
screen:expect([[
|
||||||
|
{2: 1 }1 |
|
||||||
|
{2: 2 }2 |
|
||||||
|
{2: 3 }3 |
|
||||||
|
{2: 4 }4 |
|
||||||
|
{2: 5 }5 |
|
||||||
|
{1:-- More --}^ |
|
||||||
|
]])
|
||||||
|
feed(':')
|
||||||
|
screen:expect([[
|
||||||
|
{2: 1 }1 |
|
||||||
|
{2: 2 }2 |
|
||||||
|
{2: 3 }3 |
|
||||||
|
{2: 4 }4 |
|
||||||
|
{2: 5 }5 |
|
||||||
|
:^ |
|
||||||
|
]])
|
||||||
|
feed("echo 'Hello'\n")
|
||||||
|
screen:expect([[
|
||||||
|
{2: 2 }2 |
|
||||||
|
{2: 3 }3 |
|
||||||
|
{2: 4 }4 |
|
||||||
|
{2: 5 }5 |
|
||||||
|
Hello |
|
||||||
|
{1:Press ENTER or type command to continue}^ |
|
||||||
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- oldtest: Test_quit_long_message()
|
-- oldtest: Test_quit_long_message()
|
||||||
|
Reference in New Issue
Block a user