diff src/testdir/test_cmdline.vim @ 13998:c3f9c37160e7 v8.1.0017

patch 8.1.0017: shell command completion has duplicates commit https://github.com/vim/vim/commit/62fe66f251263715968442e237742d9d3dfd5fa1 Author: Bram Moolenaar <Bram@vim.org> Date: Tue May 22 16:58:47 2018 +0200 patch 8.1.0017: shell command completion has duplicates Problem: Shell command completion has duplicates. (Yegappan Lakshmanan) Solution: Use a hash table to avoid duplicates. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/539, closes #2733)
author Christian Brabandt <cb@256bit.org>
date Tue, 22 May 2018 17:00:06 +0200
parents 3aac8d62351c
children ee649db58c41
line wrap: on
line diff
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -231,6 +231,15 @@ func Test_getcompletion()
   let l = getcompletion('not', 'mapclear')
   call assert_equal([], l)
 
+  let l = getcompletion('.', 'shellcmd')
+  call assert_equal(['./', '../'], l[0:1])
+  call assert_equal(-1, match(l[2:], '^\.\.\?/$'))
+  let root = has('win32') ? 'C:\\' : '/'
+  let l = getcompletion(root, 'shellcmd')
+  let expected = map(filter(glob(root . '*', 0, 1),
+        \ 'isdirectory(v:val) || executable(v:val)'), 'isdirectory(v:val) ? v:val . ''/'' : v:val')
+  call assert_equal(expected, l)
+
   if has('cscope')
     let l = getcompletion('', 'cscope')
     let cmds = ['add', 'find', 'help', 'kill', 'reset', 'show']
@@ -258,8 +267,7 @@ func Test_getcompletion()
   endif
 
   " For others test if the name is recognized.
-  let names = ['buffer', 'environment', 'file_in_path',
-	\ 'mapping', 'shellcmd', 'tag', 'tag_listfiles', 'user']
+  let names = ['buffer', 'environment', 'file_in_path', 'mapping', 'tag', 'tag_listfiles', 'user']
   if has('cmdline_hist')
     call add(names, 'history')
   endif