aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_cmdline.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-12-09 06:12:13 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-12-09 07:52:50 +0800
commit41282259ba0d0e4ae97caa4c6e77095b1d935e80 (patch)
tree5fbaafe3227a83d575a5df99e1b25ad001395258 /src/nvim/testdir/test_cmdline.vim
parent8b3412636a1027eaa14a95211efb449b58e9a01e (diff)
downloadrneovim-41282259ba0d0e4ae97caa4c6e77095b1d935e80.tar.gz
rneovim-41282259ba0d0e4ae97caa4c6e77095b1d935e80.tar.bz2
rneovim-41282259ba0d0e4ae97caa4c6e77095b1d935e80.zip
vim-patch:8.2.4366: not enough tests for command line completion
Problem: Not enough tests for command line completion. Solution: Add a few more tests. (Yegappan Lakshmanan, closes vim/vim#9760) https://github.com/vim/vim/commit/4d03d870007c593bce2cfa8d0a6597ca3a20fa35 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/testdir/test_cmdline.vim')
-rw-r--r--src/nvim/testdir/test_cmdline.vim47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim
index 9889e46a06..a259d6d85c 100644
--- a/src/nvim/testdir/test_cmdline.vim
+++ b/src/nvim/testdir/test_cmdline.vim
@@ -515,11 +515,17 @@ func Test_getcompletion()
call assert_equal(cmds, l)
let l = getcompletion('list ', 'sign')
call assert_equal(['Testing'], l)
+ let l = getcompletion('de*', 'sign')
+ call assert_equal(['define'], l)
+ let l = getcompletion('p?', 'sign')
+ call assert_equal(['place'], l)
+ let l = getcompletion('j.', 'sign')
+ call assert_equal(['jump'], l)
endif
" Command line completion tests
let l = getcompletion('cd ', 'cmdline')
- call assert_true(index(l, 'sautest/') >= 0)
+ call assert_true(index(l, 'samples/') >= 0)
let l = getcompletion('cd NoMatch', 'cmdline')
call assert_equal([], l)
let l = getcompletion('let v:n', 'cmdline')
@@ -567,6 +573,18 @@ func Test_getcompletion()
call delete('Xtags')
set tags&
+ edit a~b
+ enew
+ call assert_equal(['a~b'], getcompletion('a~', 'buffer'))
+ bw a~b
+
+ if has('unix')
+ edit Xtest\
+ enew
+ call assert_equal(['Xtest\'], getcompletion('Xtest\', 'buffer'))
+ bw Xtest\
+ endif
+
call assert_fails("call getcompletion('\\\\@!\\\\@=', 'buffer')", 'E871:')
call assert_fails('call getcompletion("", "burp")', 'E475:')
call assert_fails('call getcompletion("abc", [])', 'E475:')
@@ -1109,6 +1127,25 @@ func Test_cmdline_complete_various()
call feedkeys(":chist\<Esc>\<Esc>", 'xt')
call assert_equal('"g/a\xb/clearjumps', @:)
set wildchar&
+
+ " should be able to complete a file name that starts with a '~'.
+ if has('unix')
+ call writefile([], '~Xtest')
+ call feedkeys(":e \\~X\<Tab>\<C-B>\"\<CR>", 'xt')
+ call assert_equal('"e \~Xtest', @:)
+ call delete('~Xtest')
+ endif
+endfunc
+
+" Test for 'wildignorecase'
+func Test_cmdline_wildignorecase()
+ CheckUnix
+ call writefile([], 'XTEST')
+ set wildignorecase
+ call feedkeys(":e xt\<Tab>\<C-B>\"\<CR>", 'xt')
+ call assert_equal('"e XTEST', @:)
+ set wildignorecase&
+ call delete('XTEST')
endfunc
func Test_cmdline_write_alternatefile()
@@ -1773,6 +1810,14 @@ func Test_wildmode()
call assert_equal('AAA AAAA AAAAA', g:Sline)
call assert_equal('"b A', @:)
+ " when using longest completion match, matches shorter than the argument
+ " should be ignored (happens with :help)
+ set wildmode=longest,full
+ set wildmenu
+ call feedkeys(":help a*\t\<C-B>\"\<CR>", 'xt')
+ call assert_equal('"help a', @:)
+ set wildmenu&
+
%argdelete
delcommand MyCmd
delfunc T