diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-16 21:39:05 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-16 21:55:27 +0800 |
commit | 780edfc0eb1293f5813d904ad61fc65bbbb41784 (patch) | |
tree | 7bb4d31d5cd799d8158360722eb6cb989ff14633 | |
parent | bc73795a5858129a84d510f682c9dcb17aa1813a (diff) | |
download | rneovim-780edfc0eb1293f5813d904ad61fc65bbbb41784.tar.gz rneovim-780edfc0eb1293f5813d904ad61fc65bbbb41784.tar.bz2 rneovim-780edfc0eb1293f5813d904ad61fc65bbbb41784.zip |
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)
https://github.com/vim/vim/commit/f4fcedc59d4cc5ae6b5270a933e8377030283c1c
Cherry-pick related changes from patches 8.2.{0433,0866}.
-rw-r--r-- | src/nvim/testdir/test_messages.vim | 21 | ||||
-rw-r--r-- | src/nvim/testdir/test_registers.vim | 10 | ||||
-rw-r--r-- | src/nvim/testdir/test_undo.vim | 14 | ||||
-rw-r--r-- | test/functional/legacy/messages_spec.lua | 29 |
4 files changed, 66 insertions, 8 deletions
diff --git a/src/nvim/testdir/test_messages.vim b/src/nvim/testdir/test_messages.vim index fb6c9c1554..5670368936 100644 --- a/src/nvim/testdir/test_messages.vim +++ b/src/nvim/testdir/test_messages.vim @@ -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 diff --git a/src/nvim/testdir/test_registers.vim b/src/nvim/testdir/test_registers.vim index abe28b77cd..52e745438d 100644 --- a/src/nvim/testdir/test_registers.vim +++ b/src/nvim/testdir/test_registers.vim @@ -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') diff --git a/src/nvim/testdir/test_undo.vim b/src/nvim/testdir/test_undo.vim index da8bf12318..efc39fb3f5 100644 --- a/src/nvim/testdir/test_undo.vim +++ b/src/nvim/testdir/test_undo.vim @@ -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. diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua index 2b0e6941ef..b296ac909d 100644 --- a/test/functional/legacy/messages_spec.lua +++ b/test/functional/legacy/messages_spec.lua @@ -261,6 +261,35 @@ describe('messages', function() ^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) -- oldtest: Test_quit_long_message() |