comparison src/testdir/test_cmdline.vim @ 9672:6255ff1ea003 v7.4.2112

commit https://github.com/vim/vim/commit/b56195ed00a9a79aa6217cddbeedbc8cc7a5b6d8 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 28 22:53:37 2016 +0200 patch 7.4.2112 Problem: getcompletion(.., 'dir') returns a match with trailing "*" when there are no matches. (Chdiza) Solution: Return an empty list when there are no matches. Add a trailing slash to directories. (Yegappan Lakshmanan) Add tests for no matches. (closes #947)
author Christian Brabandt <cb@256bit.org>
date Thu, 28 Jul 2016 23:00:06 +0200
parents af0d98d8836e
children be9b5f8c3fd9
comparison
equal deleted inserted replaced
9671:5d7216118c8a 9672:6255ff1ea003
45 call assert_true(matchcount > 0) 45 call assert_true(matchcount > 0)
46 endif 46 endif
47 47
48 let l = getcompletion('v:n', 'var') 48 let l = getcompletion('v:n', 'var')
49 call assert_true(index(l, 'v:null') >= 0) 49 call assert_true(index(l, 'v:null') >= 0)
50 let l = getcompletion('v:notexists', 'var')
51 call assert_equal([], l)
50 52
51 let l = getcompletion('', 'augroup') 53 let l = getcompletion('', 'augroup')
52 call assert_true(index(l, 'END') >= 0) 54 call assert_true(index(l, 'END') >= 0)
55 let l = getcompletion('blahblah', 'augroup')
56 call assert_equal([], l)
53 57
54 let l = getcompletion('', 'behave') 58 let l = getcompletion('', 'behave')
55 call assert_true(index(l, 'mswin') >= 0) 59 call assert_true(index(l, 'mswin') >= 0)
60 let l = getcompletion('not', 'behave')
61 call assert_equal([], l)
56 62
57 let l = getcompletion('', 'color') 63 let l = getcompletion('', 'color')
58 call assert_true(index(l, 'default') >= 0) 64 call assert_true(index(l, 'default') >= 0)
65 let l = getcompletion('dirty', 'color')
66 call assert_equal([], l)
59 67
60 let l = getcompletion('', 'command') 68 let l = getcompletion('', 'command')
61 call assert_true(index(l, 'sleep') >= 0) 69 call assert_true(index(l, 'sleep') >= 0)
70 let l = getcompletion('awake', 'command')
71 call assert_equal([], l)
62 72
63 let l = getcompletion('', 'dir') 73 let l = getcompletion('', 'dir')
64 call assert_true(index(l, 'samples') >= 0) 74 call assert_true(index(l, 'samples/') >= 0)
75 let l = getcompletion('NoMatch', 'dir')
76 call assert_equal([], l)
65 77
66 let l = getcompletion('exe', 'expression') 78 let l = getcompletion('exe', 'expression')
67 call assert_true(index(l, 'executable(') >= 0) 79 call assert_true(index(l, 'executable(') >= 0)
80 let l = getcompletion('kill', 'expression')
81 call assert_equal([], l)
68 82
69 let l = getcompletion('tag', 'function') 83 let l = getcompletion('tag', 'function')
70 call assert_true(index(l, 'taglist(') >= 0) 84 call assert_true(index(l, 'taglist(') >= 0)
85 let l = getcompletion('paint', 'function')
86 call assert_equal([], l)
71 87
72 let Flambda = {-> 'hello'} 88 let Flambda = {-> 'hello'}
73 let l = getcompletion('', 'function') 89 let l = getcompletion('', 'function')
74 let l = filter(l, {i, v -> v =~ 'lambda'}) 90 let l = filter(l, {i, v -> v =~ 'lambda'})
75 call assert_equal(0, len(l)) 91 call assert_equal([], l)
76 92
77 let l = getcompletion('run', 'file') 93 let l = getcompletion('run', 'file')
78 call assert_true(index(l, 'runtest.vim') >= 0) 94 call assert_true(index(l, 'runtest.vim') >= 0)
95 let l = getcompletion('walk', 'file')
96 call assert_equal([], l)
79 97
80 let l = getcompletion('ha', 'filetype') 98 let l = getcompletion('ha', 'filetype')
81 call assert_true(index(l, 'hamster') >= 0) 99 call assert_true(index(l, 'hamster') >= 0)
100 let l = getcompletion('horse', 'filetype')
101 call assert_equal([], l)
82 102
83 let l = getcompletion('z', 'syntax') 103 let l = getcompletion('z', 'syntax')
84 call assert_true(index(l, 'zimbu') >= 0) 104 call assert_true(index(l, 'zimbu') >= 0)
105 let l = getcompletion('emacs', 'syntax')
106 call assert_equal([], l)
85 107
86 let l = getcompletion('jikes', 'compiler') 108 let l = getcompletion('jikes', 'compiler')
87 call assert_true(index(l, 'jikes') >= 0) 109 call assert_true(index(l, 'jikes') >= 0)
110 let l = getcompletion('break', 'compiler')
111 call assert_equal([], l)
88 112
89 let l = getcompletion('last', 'help') 113 let l = getcompletion('last', 'help')
90 call assert_true(index(l, ':tablast') >= 0) 114 call assert_true(index(l, ':tablast') >= 0)
115 let l = getcompletion('giveup', 'help')
116 call assert_equal([], l)
91 117
92 let l = getcompletion('time', 'option') 118 let l = getcompletion('time', 'option')
93 call assert_true(index(l, 'timeoutlen') >= 0) 119 call assert_true(index(l, 'timeoutlen') >= 0)
120 let l = getcompletion('space', 'option')
121 call assert_equal([], l)
94 122
95 let l = getcompletion('er', 'highlight') 123 let l = getcompletion('er', 'highlight')
96 call assert_true(index(l, 'ErrorMsg') >= 0) 124 call assert_true(index(l, 'ErrorMsg') >= 0)
125 let l = getcompletion('dark', 'highlight')
126 call assert_equal([], l)
97 127
98 " For others test if the name is recognized. 128 " For others test if the name is recognized.
99 let names = ['buffer', 'environment', 'file_in_path', 129 let names = ['buffer', 'environment', 'file_in_path',
100 \ 'mapping', 'shellcmd', 'tag', 'tag_listfiles', 'user'] 130 \ 'mapping', 'shellcmd', 'tag', 'tag_listfiles', 'user']
101 if has('cscope') 131 if has('cscope')