@@ -45,5 +45,79 @@ func Test_getcompletion()
4545 call assert_true (matchcount > 0 )
4646 endif
4747
48+ let l = getcompletion (' v:n' , ' var' )
49+ call assert_true (index (l , ' v:null' ) >= 0 )
50+
51+ let l = getcompletion (' ' , ' augroup' )
52+ call assert_true (index (l , ' END' ) >= 0 )
53+
54+ let l = getcompletion (' ' , ' behave' )
55+ call assert_true (index (l , ' mswin' ) >= 0 )
56+
57+ let l = getcompletion (' ' , ' color' )
58+ call assert_true (index (l , ' default' ) >= 0 )
59+
60+ let l = getcompletion (' ' , ' command' )
61+ call assert_true (index (l , ' sleep' ) >= 0 )
62+
63+ let l = getcompletion (' ' , ' dir' )
64+ call assert_true (index (l , ' samples' ) >= 0 )
65+
66+ let l = getcompletion (' exe' , ' expression' )
67+ call assert_true (index (l , ' executable(' ) >= 0 )
68+
69+ let l = getcompletion (' tag' , ' function' )
70+ call assert_true (index (l , ' taglist(' ) >= 0 )
71+
72+ let l = getcompletion (' run' , ' file' )
73+ call assert_true (index (l , ' runtest.vim' ) >= 0 )
74+
75+ let l = getcompletion (' ha' , ' filetype' )
76+ call assert_true (index (l , ' hamster' ) >= 0 )
77+
78+ let l = getcompletion (' z' , ' syntax' )
79+ call assert_true (index (l , ' zimbu' ) >= 0 )
80+
81+ let l = getcompletion (' jikes' , ' compiler' )
82+ call assert_true (index (l , ' jikes' ) >= 0 )
83+
84+ let l = getcompletion (' last' , ' help' )
85+ call assert_true (index (l , ' :tablast' ) >= 0 )
86+
87+ let l = getcompletion (' time' , ' option' )
88+ call assert_true (index (l , ' timeoutlen' ) >= 0 )
89+
90+ let l = getcompletion (' er' , ' highlight' )
91+ call assert_true (index (l , ' ErrorMsg' ) >= 0 )
92+
93+ " For others test if the name is recognized.
94+ let names = [' buffer' , ' environment' , ' file_in_path' ,
95+ \ ' mapping' , ' shellcmd' , ' tag' , ' tag_listfiles' , ' user' ]
96+ if has (' cscope' )
97+ call add (names, ' cscope' )
98+ endif
99+ if has (' cmdline_hist' )
100+ call add (names, ' history' )
101+ endif
102+ if has (' gettext' )
103+ call add (names, ' locale' )
104+ endif
105+ if has (' profile' )
106+ call add (names, ' syntime' )
107+ endif
108+ if has (' signs' )
109+ call add (names, ' sign' )
110+ endif
111+
112+ set tags = Xtags
113+ call writefile ([" !_TAG_FILE_ENCODING\t utf-8\t //" , " word\t file\t cmd" ], ' Xtags' )
114+
115+ for name in names
116+ let matchcount = len (getcompletion (' ' , name))
117+ call assert_true (matchcount >= 0 , ' No matches for ' . name)
118+ endfor
119+
120+ call delete (' Xtags' )
121+
48122 call assert_fails (' call getcompletion("", "burp")' , ' E475:' )
49123endfunc
0 commit comments