@@ -41,12 +41,18 @@ func Test_compiler()
4141 bw !
4242endfunc
4343
44+ func GetCompilerNames ()
45+ return glob (' $VIMRUNTIME/compiler/*.vim' , 0 , 1 )
46+ \ - >map ({k , v - > substitute (v , ' .*[\\/]\([a-zA-Z0-9_\-]*\).vim' , ' \1' , ' ' )})
47+ endfunc
48+
4449func Test_compiler_without_arg ()
4550 let runtime = substitute ($VIMRUNTIME , ' \\' , ' /' , ' g' )
4651 let a = split (execute (' compiler' ))
47- call assert_match (runtime .. ' /compiler/ant.vim$' , a [0 ])
48- call assert_match (runtime .. ' /compiler/bcc.vim$' , a [1 ])
49- call assert_match (runtime .. ' /compiler/xo.vim$' , a [-1 ])
52+ let exp = GetCompilerNames ()
53+ call assert_match (runtime .. ' /compiler/' .. exp [0 ] .. ' .vim$' , a [0 ])
54+ call assert_match (runtime .. ' /compiler/' .. exp [1 ] .. ' .vim$' , a [1 ])
55+ call assert_match (runtime .. ' /compiler/' .. exp [-1 ] .. ' .vim$' , a [-1 ])
5056endfunc
5157
5258" Test executing :compiler from the command line, not from a script
@@ -59,8 +65,9 @@ func Test_compiler_commandline()
5965endfunc
6066
6167func Test_compiler_completion ()
68+ let clist = GetCompilerNames ()- >join (' ' )
6269 call feedkeys (" :compiler \<C-A>\<C-B> \" \<CR> " , ' tx' )
63- call assert_match (' ^"compiler ant bcc .* xmlwf xo $' , @: )
70+ call assert_match (' ^"compiler ' .. clist .. ' $' , @: )
6471
6572 call feedkeys (" :compiler p\<C-A>\<C-B> \" \<CR> " , ' tx' )
6673 call assert_equal (' "compiler pbx perl php pylint pyunit' , @: )
0 commit comments