2018-08-02 22:44:12 +00:00
|
|
|
Before:
|
|
|
|
" Make sure the c.vim file is loaded first.
|
|
|
|
call ale#c#FindProjectRoot(bufnr(''))
|
|
|
|
|
2019-05-20 18:57:08 +00:00
|
|
|
Save g:ale_c_parse_compile_commands
|
2018-08-02 22:44:12 +00:00
|
|
|
Save g:ale_c_parse_makefile
|
|
|
|
Save g:__ale_c_project_filenames
|
|
|
|
|
|
|
|
let g:original_project_filenames = g:__ale_c_project_filenames
|
2020-08-20 00:46:29 +00:00
|
|
|
let g:executable_map = {}
|
2018-08-02 22:44:12 +00:00
|
|
|
|
|
|
|
" Remove the .git/HEAD dir for C import paths for these tests.
|
|
|
|
" The tests run inside of a git repo.
|
|
|
|
let g:__ale_c_project_filenames = filter(
|
|
|
|
\ copy(g:__ale_c_project_filenames),
|
|
|
|
\ 'v:val isnot# ''.git/HEAD'''
|
|
|
|
\)
|
|
|
|
|
2019-05-20 18:57:08 +00:00
|
|
|
let g:ale_c_parse_compile_commands = 0
|
2018-08-02 22:44:12 +00:00
|
|
|
let g:ale_c_parse_makefile = 0
|
|
|
|
|
2020-08-20 00:46:29 +00:00
|
|
|
runtime autoload/ale/engine.vim
|
|
|
|
|
|
|
|
function! ale#engine#IsExecutable(buffer, executable) abort
|
|
|
|
return has_key(g:executable_map, a:executable)
|
|
|
|
endfunction
|
|
|
|
|
2018-08-02 22:44:12 +00:00
|
|
|
After:
|
2019-05-20 12:00:32 +00:00
|
|
|
Restore
|
|
|
|
|
2018-08-02 22:44:12 +00:00
|
|
|
unlet! g:original_project_filenames
|
2020-08-20 00:46:29 +00:00
|
|
|
unlet! g:executable_map
|
|
|
|
|
|
|
|
runtime autoload/ale/engine.vim
|
2018-08-02 22:44:12 +00:00
|
|
|
|
|
|
|
call ale#assert#TearDownLinterTest()
|
|
|
|
|
2020-08-20 00:46:29 +00:00
|
|
|
Execute(The C cc linter should include 'include' directories for projects with a Makefile):
|
|
|
|
call ale#assert#SetUpLinterTest('c', 'cc')
|
2018-08-02 22:44:12 +00:00
|
|
|
call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.c')
|
2020-08-20 00:46:29 +00:00
|
|
|
let g:ale_c_cc_options = ''
|
2018-08-02 22:44:12 +00:00
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
2020-08-28 18:50:36 +00:00
|
|
|
\ . ' -iquote %s:h'
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
|
|
|
|
\ . ' -'
|
|
|
|
|
2020-08-20 00:46:29 +00:00
|
|
|
Execute(The C cc linter should include 'include' directories for projects with a configure file):
|
|
|
|
call ale#assert#SetUpLinterTest('c', 'cc')
|
2018-08-02 22:44:12 +00:00
|
|
|
call ale#test#SetFilename('../test_c_projects/configure_project/subdir/file.c')
|
2020-08-20 00:46:29 +00:00
|
|
|
let g:ale_c_cc_options = ''
|
2018-08-02 22:44:12 +00:00
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
2020-08-28 18:50:36 +00:00
|
|
|
\ . ' -iquote %s:h'
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
|
|
|
|
\ . ' -'
|
|
|
|
|
2020-08-20 00:46:29 +00:00
|
|
|
Execute(The C cc linter should include root directories for projects with .h files in them):
|
|
|
|
call ale#assert#SetUpLinterTest('c', 'cc')
|
2018-08-02 22:44:12 +00:00
|
|
|
call ale#test#SetFilename('../test_c_projects/h_file_project/subdir/file.c')
|
2020-08-20 00:46:29 +00:00
|
|
|
let g:ale_c_cc_options = ''
|
2018-08-02 22:44:12 +00:00
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
2020-08-28 18:50:36 +00:00
|
|
|
\ . ' -iquote %s:h'
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
|
|
|
|
\ . ' -'
|
|
|
|
|
2020-08-20 00:46:29 +00:00
|
|
|
Execute(The C cc linter should include root directories for projects with .hpp files in them):
|
|
|
|
call ale#assert#SetUpLinterTest('c', 'cc')
|
2018-08-02 22:44:12 +00:00
|
|
|
call ale#test#SetFilename('../test_c_projects/hpp_file_project/subdir/file.c')
|
2020-08-20 00:46:29 +00:00
|
|
|
let g:ale_c_cc_options = ''
|
2018-08-02 22:44:12 +00:00
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
2020-08-28 18:50:36 +00:00
|
|
|
\ . ' -iquote %s:h'
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
|
|
|
|
\ . ' -'
|
|
|
|
|
2019-10-06 16:29:23 +00:00
|
|
|
Execute(The C ClangTidy handler should include 'include' directories for projects with a Makefile):
|
|
|
|
call ale#assert#SetUpLinterTest('c', 'clangtidy')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.cpp')
|
|
|
|
let g:ale_c_clangtidy_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'clang-tidy',
|
|
|
|
\ ale#Escape('clang-tidy')
|
|
|
|
\ . ' %s '
|
|
|
|
\ . '-- -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
|
|
|
|
|
2020-08-20 00:46:29 +00:00
|
|
|
Execute(The C++ cc linter should include 'include' directories for projects with a Makefile):
|
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'cc')
|
2018-08-02 22:44:12 +00:00
|
|
|
call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.cpp')
|
2020-08-20 00:46:29 +00:00
|
|
|
let g:ale_cpp_cc_options = ''
|
2018-08-02 22:44:12 +00:00
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
2020-08-28 18:50:36 +00:00
|
|
|
\ . ' -iquote %s:h'
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
|
|
|
|
\ . ' -'
|
|
|
|
|
2020-08-20 00:46:29 +00:00
|
|
|
Execute(The C++ cc linter should include 'include' directories for projects with a configure file):
|
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'cc')
|
2018-08-02 22:44:12 +00:00
|
|
|
call ale#test#SetFilename('../test_c_projects/configure_project/subdir/file.cpp')
|
2020-08-20 00:46:29 +00:00
|
|
|
let g:ale_cpp_cc_options = ''
|
2018-08-02 22:44:12 +00:00
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
2020-08-28 18:50:36 +00:00
|
|
|
\ . ' -iquote %s:h'
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
|
|
|
|
\ . ' -'
|
|
|
|
|
2020-08-20 00:46:29 +00:00
|
|
|
Execute(The C++ cc linter should include root directories for projects with .h files in them):
|
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'cc')
|
2018-08-02 22:44:12 +00:00
|
|
|
call ale#test#SetFilename('../test_c_projects/h_file_project/subdir/file.cpp')
|
2020-08-20 00:46:29 +00:00
|
|
|
let g:ale_cpp_cc_options = ''
|
2018-08-02 22:44:12 +00:00
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
2020-08-28 18:50:36 +00:00
|
|
|
\ . ' -iquote %s:h'
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
|
|
|
|
\ . ' -'
|
|
|
|
|
2020-08-20 00:46:29 +00:00
|
|
|
Execute(The C++ cc linter should include root directories for projects with .hpp files in them):
|
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'cc')
|
2018-08-02 22:44:12 +00:00
|
|
|
call ale#test#SetFilename('../test_c_projects/hpp_file_project/subdir/file.cpp')
|
2020-08-20 00:46:29 +00:00
|
|
|
let g:ale_cpp_cc_options = ''
|
2018-08-02 22:44:12 +00:00
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
2020-08-28 18:50:36 +00:00
|
|
|
\ . ' -iquote %s:h'
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
|
|
|
|
\ . ' -'
|
|
|
|
|
|
|
|
Execute(The C++ ClangTidy handler should include json folders for projects with suitable build directory in them):
|
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/json_project/subdir/file.cpp')
|
|
|
|
|
|
|
|
AssertLinter 'clang-tidy',
|
|
|
|
\ ale#Escape('clang-tidy')
|
2018-10-29 22:48:05 +00:00
|
|
|
\ . ' %s '
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . '-p ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/json_project/build'))
|
2019-10-06 16:29:23 +00:00
|
|
|
|
|
|
|
Execute(The C++ ClangTidy handler should include 'include' directories for projects with a Makefile):
|
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.cpp')
|
|
|
|
let g:ale_cpp_clangtidy_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'clang-tidy',
|
|
|
|
\ ale#Escape('clang-tidy')
|
|
|
|
\ . ' %s '
|
|
|
|
\ . '-- -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
|
|
|
|
|