comparison src/testdir/test_compiler.vim @ 22981:72e0ec552189 v8.2.2037

patch 8.2.2037: compiler test depends on list of compiler plugins Commit: https://github.com/vim/vim/commit/60bc8e7244080b7ead009cfabebc3401f272ddbe Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 23 21:24:58 2020 +0100 patch 8.2.2037: compiler test depends on list of compiler plugins Problem: Compiler test depends on list of compiler plugins. Solution: Compare with the actual list of compiler plugins.
author Bram Moolenaar <Bram@vim.org>
date Mon, 23 Nov 2020 21:30:04 +0100
parents 08940efa6b4e
children 1e1422df34e3
comparison
equal deleted inserted replaced
22980:85af9c781df0 22981:72e0ec552189
39 let &shellslash = save_shellslash 39 let &shellslash = save_shellslash
40 call delete('Xfoo.pl') 40 call delete('Xfoo.pl')
41 bw! 41 bw!
42 endfunc 42 endfunc
43 43
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
44 func Test_compiler_without_arg() 49 func Test_compiler_without_arg()
45 let runtime = substitute($VIMRUNTIME, '\\', '/', 'g') 50 let runtime = substitute($VIMRUNTIME, '\\', '/', 'g')
46 let a = split(execute('compiler')) 51 let a = split(execute('compiler'))
47 call assert_match(runtime .. '/compiler/ant.vim$', a[0]) 52 let exp = GetCompilerNames()
48 call assert_match(runtime .. '/compiler/bcc.vim$', a[1]) 53 call assert_match(runtime .. '/compiler/' .. exp[0] .. '.vim$', a[0])
49 call assert_match(runtime .. '/compiler/xo.vim$', a[-1]) 54 call assert_match(runtime .. '/compiler/' .. exp[1] .. '.vim$', a[1])
55 call assert_match(runtime .. '/compiler/' .. exp[-1] .. '.vim$', a[-1])
50 endfunc 56 endfunc
51 57
52 " Test executing :compiler from the command line, not from a script 58 " Test executing :compiler from the command line, not from a script
53 func Test_compiler_commandline() 59 func Test_compiler_commandline()
54 call system(GetVimCommandClean() .. ' --not-a-term -c "compiler gcc" -c "call writefile([b:current_compiler], ''XcompilerOut'')" -c "quit"') 60 call system(GetVimCommandClean() .. ' --not-a-term -c "compiler gcc" -c "call writefile([b:current_compiler], ''XcompilerOut'')" -c "quit"')
57 63
58 call delete('XcompilerOut') 64 call delete('XcompilerOut')
59 endfunc 65 endfunc
60 66
61 func Test_compiler_completion() 67 func Test_compiler_completion()
68 let clist = GetCompilerNames()->join(' ')
62 call feedkeys(":compiler \<C-A>\<C-B>\"\<CR>", 'tx') 69 call feedkeys(":compiler \<C-A>\<C-B>\"\<CR>", 'tx')
63 call assert_match('^"compiler ant bcc .* xmlwf xo$', @:) 70 call assert_match('^"compiler ' .. clist .. '$', @:)
64 71
65 call feedkeys(":compiler p\<C-A>\<C-B>\"\<CR>", 'tx') 72 call feedkeys(":compiler p\<C-A>\<C-B>\"\<CR>", 'tx')
66 call assert_equal('"compiler pbx perl php pylint pyunit', @:) 73 call assert_equal('"compiler pbx perl php pylint pyunit', @:)
67 74
68 call feedkeys(":compiler! p\<C-A>\<C-B>\"\<CR>", 'tx') 75 call feedkeys(":compiler! p\<C-A>\<C-B>\"\<CR>", 'tx')