aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_cmdline.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-13 21:14:08 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-07-14 15:40:07 +0800
commitc467df997eadc077003ff27908c0782b27ff6b97 (patch)
tree80ae52cd3b6dcb90c5239b37a1fa27ceaf19f9aa /src/nvim/testdir/test_cmdline.vim
parentb81d1eb26502f403574113385a75444f8880828e (diff)
downloadrneovim-c467df997eadc077003ff27908c0782b27ff6b97.tar.gz
rneovim-c467df997eadc077003ff27908c0782b27ff6b97.tar.bz2
rneovim-c467df997eadc077003ff27908c0782b27ff6b97.zip
vim-patch:8.2.0342: some code in ex_getln.c not covered by tests
Problem: Some code in ex_getln.c not covered by tests. Solution: Add more tests. (Yegappan Lakshmanan, closes vim/vim#5717) https://github.com/vim/vim/commit/0546d7df13b041833121b2d56036e1c62ea3b0c1 Nvim doesn't support imsearch=2, commenting out that line is enough. Test_Ex_append() is not applicable to Vim enhanced Ex mode. Omit test_iminsert.vim as previous patches to that file are N/A.
Diffstat (limited to 'src/nvim/testdir/test_cmdline.vim')
-rw-r--r--src/nvim/testdir/test_cmdline.vim35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim
index 3863d25ee7..b5ee5e802d 100644
--- a/src/nvim/testdir/test_cmdline.vim
+++ b/src/nvim/testdir/test_cmdline.vim
@@ -1558,6 +1558,7 @@ endfunc
func Test_cmdline_edit()
let str = ":one two\<C-U>"
let str ..= "one two\<C-W>\<C-W>"
+ let str ..= "one\<BS>\<C-H>\<Del>"
let str ..= "\<Left>five\<Right>"
let str ..= "\<Home>two "
let str ..= "\<C-Left>one "
@@ -1576,6 +1577,7 @@ func Test_cmdline_edit_rightleft()
set rightleftcmd=search
let str = "/one two\<C-U>"
let str ..= "one two\<C-W>\<C-W>"
+ let str ..= "one\<BS>\<C-H>\<Del>"
let str ..= "\<Right>five\<Left>"
let str ..= "\<Home>two "
let str ..= "\<C-Right>one "
@@ -1603,6 +1605,39 @@ func Test_cmdline_expr()
call assert_equal("\"e \<C-\>\<C-Y>", @:)
endfunc
+" Test for 'imcmdline' and 'imsearch'
+" This test doesn't actually test the input method functionality.
+func Test_cmdline_inputmethod()
+ new
+ call setline(1, ['', 'abc', ''])
+ set imcmdline
+
+ call feedkeys(":\"abc\<CR>", 'xt')
+ call assert_equal("\"abc", @:)
+ call feedkeys(":\"\<C-^>abc\<C-^>\<CR>", 'xt')
+ call assert_equal("\"abc", @:)
+ call feedkeys("/abc\<CR>", 'xt')
+ call assert_equal([2, 1], [line('.'), col('.')])
+ call feedkeys("/\<C-^>abc\<C-^>\<CR>", 'xt')
+ call assert_equal([2, 1], [line('.'), col('.')])
+
+ " set imsearch=2
+ call cursor(1, 1)
+ call feedkeys("/abc\<CR>", 'xt')
+ call assert_equal([2, 1], [line('.'), col('.')])
+ call cursor(1, 1)
+ call feedkeys("/\<C-^>abc\<C-^>\<CR>", 'xt')
+ call assert_equal([2, 1], [line('.'), col('.')])
+ set imdisable
+ call feedkeys("/\<C-^>abc\<C-^>\<CR>", 'xt')
+ call assert_equal([2, 1], [line('.'), col('.')])
+ set imdisable&
+ set imsearch&
+
+ set imcmdline&
+ %bwipe!
+endfunc
+
" Test for normal mode commands not supported in the cmd window
func Test_cmdwin_blocked_commands()
call assert_fails('call feedkeys("q:\<C-T>\<CR>", "xt")', 'E11:')