diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-05-22 16:58:47 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-05-22 16:58:47 +0200 |
commit | 62fe66f251263715968442e237742d9d3dfd5fa1 (patch) | |
tree | 17a95bf476e85695ea332ef5bc2e50371d66622d /src/testdir | |
parent | d45aa55d42211eb2f42e0a04ff77537a5df51c40 (diff) |
patch 8.1.0017: shell command completion has duplicatesv8.1.0017
Problem: Shell command completion has duplicates. (Yegappan Lakshmanan)
Solution: Use a hash table to avoid duplicates. (Ozaki Kiichi, closes #539,
closes #2733)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_cmdline.vim | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index 473c35dcf9..c807364ec3 100644 --- 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 |