diff src/testdir/test_cmdline.vim @ 26032:162ef12a3b5f v8.2.3550

patch 8.2.3550: completion() does not work properly Commit: https://github.com/vim/vim/commit/ae38a9db7770b38889fbf06908cc69d42b463a73 Author: Shougo Matsushita <Shougo.Matsu@gmail.com> Date: Thu Oct 21 11:39:53 2021 +0100 patch 8.2.3550: completion() does not work properly Problem: completion() does not work properly. Solution: Set xp_line and add WILD_HOME_REPLACE. (Shougo Matsushita, closes #9016)
author Bram Moolenaar <Bram@vim.org>
date Thu, 21 Oct 2021 12:45:04 +0200
parents 94a8f120a06e
children 44fe7d15881d
line wrap: on
line diff
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -305,6 +305,11 @@ func Test_getcompletion()
   let l = getcompletion('NoMatch', 'dir')
   call assert_equal([], l)
 
+  if glob('~/*') !=# ''
+    let l = getcompletion('~/', 'dir')
+    call assert_true(l[0][0] ==# '~')
+  endif
+
   let l = getcompletion('exe', 'expression')
   call assert_true(index(l, 'executable(') >= 0)
   let l = getcompletion('kill', 'expression')
@@ -418,6 +423,16 @@ func Test_getcompletion()
   let l = getcompletion('call paint', 'cmdline')
   call assert_equal([], l)
 
+  func T(a, c, p)
+    return "oneA\noneB\noneC"
+  endfunc
+  command -nargs=1 -complete=custom,T MyCmd
+  let l = getcompletion('MyCmd ', 'cmdline')
+  call assert_equal(['oneA', 'oneB', 'oneC'], l)
+
+  delcommand MyCmd
+  delfunc T
+
   " For others test if the name is recognized.
   let names = ['buffer', 'environment', 'file_in_path', 'mapping', 'tag', 'tag_listfiles', 'user']
   if has('cmdline_hist')