All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
2 Save g:ale_c_parse_makefile
3 Save g:ale_history_enabled
5 let g:ale_c_parse_makefile = 0
6 let g:ale_history_enabled = 0
8 let g:get_cflags_return_value = ''
9 let g:executable_map = {}
11 runtime autoload/ale/c.vim
12 runtime autoload/ale/engine.vim
14 function! ale#engine#IsExecutable(buffer, executable) abort
15 return has_key(g:executable_map, a:executable)
18 function! ale#c#GetCFlags(buffer, output) abort
19 return g:get_cflags_return_value
22 call ale#assert#SetUpLinterTest('cpp', 'cc')
24 let b:command_tail = ' -S -x c++'
25 \ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
27 \ . ' -std=c++14 -Wall -'
30 unlet! g:get_cflags_return_value
31 unlet! g:executable_map
34 runtime autoload/ale/c.vim
35 runtime autoload/ale/engine.vim
37 call ale#assert#TearDownLinterTest()
39 Execute(clang++ should be used instead of gcc, if available):
40 let g:executable_map = {'clang++': 1}
42 AssertLinter 'clang++', [ale#Escape('clang++') . b:command_tail]
44 Execute(The executable should be configurable):
45 AssertLinter 'gcc', [ale#Escape('gcc') . b:command_tail]
47 let b:ale_cpp_cc_executable = 'foobar'
49 AssertLinter 'foobar', [ale#Escape('foobar') . b:command_tail]
51 Execute(The -std flag should be replaced by parsed C flags):
52 let b:command_tail = substitute(b:command_tail, 'c++14', 'c++11 ', '')
53 let g:get_cflags_return_value = '-std=c++11'
55 AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail
57 Execute(gcc should not use -x c++-header with header files by default):
58 call ale#test#SetFilename('../test-files/c/hpp_file_project/test.hpp')
60 AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail
62 Execute(clang++ should use -x c++-header with header files by default):
63 let g:executable_map = {'clang++': 1}
64 let b:command_tail = substitute(b:command_tail, '-x c++', '-x c++-header', '')
66 call ale#test#SetFilename('../test-files/c/hpp_file_project/test.hpp')
68 AssertLinter 'clang++', ale#Escape('clang++') . b:command_tail
70 Execute(gcc should use -x c-header with header files if configured to do so):
71 let b:ale_cpp_cc_use_header_lang_flag = 1
72 let b:command_tail = substitute(b:command_tail, '-x c++', '-x c++-header', '')
74 call ale#test#SetFilename('../test-files/c/hpp_file_project/test.hpp')
76 AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail
78 Execute(clang should not use -x c-header with header files if configured to do so):
79 let g:executable_map = {'clang++': 1}
80 let b:ale_cpp_cc_use_header_lang_flag = 0
82 call ale#test#SetFilename('../test-files/c/hpp_file_project/test.hpp')
84 AssertLinter 'clang++', ale#Escape('clang++') . b:command_tail
86 Execute(The header file extensions should be configurable):
87 let g:executable_map = {'clang++': 1}
88 let b:command_tail = substitute(b:command_tail, '-x c++', '-x c++-header', '')
90 call ale#assert#SetUpLinterTest('cpp', 'cc')
91 let b:ale_cpp_cc_header_exts = ['json']
92 call ale#test#SetFilename('../test-files/c/json_project/build/compile_commands.json')
94 AssertLinter 'clang++', ale#Escape('clang++') . b:command_tail