summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_cmdline.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-15 22:41:53 +0200
committerChristian Brabandt <cb@256bit.org>2023-08-15 22:41:53 +0200
commite4c79d36150431ffb97cb8952ec482af2e57f228 (patch)
tree651d86eca16122c9798e43b9411fd2377196741b /src/testdir/test_cmdline.vim
parentba913b14dde28f1f49b73a15f0a75038e12fde27 (diff)
patch 9.0.1714: getcompletion() "cmdline" fails after :autocmdv9.0.1714
Problem: getcompletion() "cmdline" fails after :autocmd Solution: Use set_cmd_context() instead of set_one_cmd_context(). closes: #12804 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'src/testdir/test_cmdline.vim')
-rw-r--r--src/testdir/test_cmdline.vim15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index ba3af3c71e..b5dec06956 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -612,6 +612,8 @@ func Test_getcompletion()
call assert_true(index(l, 'taglist(') >= 0)
let l = getcompletion('call paint', 'cmdline')
call assert_equal([], l)
+ let l = getcompletion('autocmd BufEnter * map <bu', 'cmdline')
+ call assert_equal(['<buffer>'], l)
func T(a, c, p)
let g:cmdline_compl_params = [a:a, a:c, a:p]
@@ -3498,14 +3500,15 @@ func Test_rulerformat_position()
call StopVimInTerminal(buf)
endfunc
-func Test_usercmd_completion()
- let g:complete=[]
+func Test_getcompletion_usercmd()
command! -nargs=* -complete=command TestCompletion echo <q-args>
- let g:complete = getcompletion('TestCompletion ', 'cmdline')
- let a = getcompletion('', 'cmdline')
- call assert_equal(a, g:complete)
+ call assert_equal(getcompletion('', 'cmdline'),
+ \ getcompletion('TestCompletion ', 'cmdline'))
+ call assert_equal(['<buffer>'],
+ \ getcompletion('TestCompletion map <bu', 'cmdline'))
+
delcom TestCompletion
- unlet! g:complete
endfunc
+
" vim: shiftwidth=2 sts=2 expandtab