summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_cmdline.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir/test_cmdline.vim')
-rw-r--r--src/testdir/test_cmdline.vim39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 8b7489e..3f6918a 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -658,7 +658,8 @@ func Test_getcompletion()
unlet g:cmdline_compl_params
" For others test if the name is recognized.
- let names = ['buffer', 'environment', 'file_in_path', 'mapping', 'tag', 'tag_listfiles', 'user']
+ let names = ['buffer', 'environment', 'file_in_path', 'dir_in_path', 'mapping', 'tag',
+ \ 'tag_listfiles', 'user']
if has('cmdline_hist')
call add(names, 'history')
endif
@@ -3612,7 +3613,7 @@ func Test_cmdline_complete_bang_cmd_argument()
endfunc
func Call_cmd_funcs()
- return string([getcmdpos(), getcmdscreenpos(), getcmdcompltype()])
+ return [getcmdpos(), getcmdscreenpos(), getcmdcompltype()]
endfunc
func Test_screenpos_and_completion()
@@ -3620,13 +3621,24 @@ func Test_screenpos_and_completion()
call assert_equal(0, getcmdscreenpos())
call assert_equal('', getcmdcompltype())
- cnoremap <expr> <F2> string([getcmdpos(), getcmdscreenpos(), getcmdcompltype()])
+ cnoremap <expr> <F2> string(Call_cmd_funcs())
call feedkeys(":let a\<F2>\<C-B>\"\<CR>", "xt")
call assert_equal("\"let a[6, 7, 'var']", @:)
call feedkeys(":quit \<F2>\<C-B>\"\<CR>", "xt")
call assert_equal("\"quit [6, 7, '']", @:)
call feedkeys(":nosuchcommand \<F2>\<C-B>\"\<CR>", "xt")
call assert_equal("\"nosuchcommand [15, 16, '']", @:)
+
+ " Check that getcmdcompltype() doesn't interfere with cmdline completion.
+ let g:results = []
+ cnoremap <F2> <Cmd>let g:results += [[getcmdline()] + Call_cmd_funcs()]<CR>
+ call feedkeys(":sign un\<Tab>\<F2>\<Tab>\<F2>\<Tab>\<F2>\<C-C>", "xt")
+ call assert_equal([
+ \ ['sign undefine', 14, 15, 'sign'],
+ \ ['sign unplace', 13, 14, 'sign'],
+ \ ['sign un', 8, 9, 'sign']], g:results)
+
+ unlet g:results
cunmap <F2>
endfunc
@@ -3858,4 +3870,25 @@ func Test_term_option()
let &cpo = _cpo
endfunc
+func Test_ex_command_completion()
+ " required for :*
+ set cpo+=*
+ let list = filter(getcompletion('', 'command'), 'exists(":" . v:val) == 0')
+ " :++ and :-- are only valid in Vim9 Script context, so they can be ignored
+ call assert_equal(['++', '--'], sort(list))
+ call assert_equal(1, exists(':k'))
+ call assert_equal(0, exists(':ke'))
+ call assert_equal(1, exists(':kee'))
+ call assert_equal(1, exists(':keep'))
+ call assert_equal(1, exists(':keepm'))
+ call assert_equal(1, exists(':keepma'))
+ call assert_equal(1, exists(':keepmar'))
+ call assert_equal(1, exists(':keepmark'))
+ call assert_equal(2, exists(':keepmarks'))
+ call assert_equal(2, exists(':keepalt'))
+ call assert_equal(2, exists(':keepjumps'))
+ call assert_equal(2, exists(':keeppatterns'))
+ set cpo-=*
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab