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
|
|
|
|
|
|
|
|
" 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
|
|
|
|
|
|
|
|
After:
|
2019-05-20 12:00:32 +00:00
|
|
|
Restore
|
|
|
|
|
2018-08-02 22:44:12 +00:00
|
|
|
unlet! g:original_project_filenames
|
|
|
|
|
|
|
|
call ale#assert#TearDownLinterTest()
|
|
|
|
|
|
|
|
Execute(The C GCC handler should include 'include' directories for projects with a Makefile):
|
|
|
|
call ale#assert#SetUpLinterTest('c', 'gcc')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.c')
|
|
|
|
let g:ale_c_gcc_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir'))
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
|
|
|
|
\ . ' -'
|
|
|
|
|
|
|
|
Execute(The C GCC handler should include 'include' directories for projects with a configure file):
|
|
|
|
call ale#assert#SetUpLinterTest('c', 'gcc')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/configure_project/subdir/file.c')
|
|
|
|
let g:ale_c_gcc_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir'))
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
|
|
|
|
\ . ' -'
|
|
|
|
|
|
|
|
Execute(The C GCC handler should include root directories for projects with .h files in them):
|
|
|
|
call ale#assert#SetUpLinterTest('c', 'gcc')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/h_file_project/subdir/file.c')
|
|
|
|
let g:ale_c_gcc_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
|
|
|
|
\ . ' -'
|
|
|
|
|
|
|
|
Execute(The C GCC handler should include root directories for projects with .hpp files in them):
|
|
|
|
call ale#assert#SetUpLinterTest('c', 'gcc')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/hpp_file_project/subdir/file.c')
|
|
|
|
let g:ale_c_gcc_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir'))
|
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 Clang handler should include 'include' directories for projects with a Makefile):
|
|
|
|
call ale#assert#SetUpLinterTest('c', 'clang')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.c')
|
|
|
|
let g:ale_c_clang_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'clang',
|
|
|
|
\ ale#Escape('clang')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c -fsyntax-only'
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir'))
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
|
|
|
|
\ . ' -'
|
|
|
|
|
|
|
|
Execute(The C Clang handler should include 'include' directories for projects with a configure file):
|
|
|
|
call ale#assert#SetUpLinterTest('c', 'clang')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/h_file_project/subdir/file.c')
|
|
|
|
let g:ale_c_clang_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'clang',
|
|
|
|
\ ale#Escape('clang')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c -fsyntax-only'
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
|
|
|
|
\ . ' -'
|
|
|
|
|
|
|
|
Execute(The C Clang handler should include root directories for projects with .h files in them):
|
|
|
|
call ale#assert#SetUpLinterTest('c', 'clang')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/h_file_project/subdir/file.c')
|
|
|
|
let g:ale_c_clang_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'clang',
|
|
|
|
\ ale#Escape('clang')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c -fsyntax-only'
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
|
|
|
|
\ . ' -'
|
|
|
|
|
|
|
|
Execute(The C Clang handler should include root directories for projects with .hpp files in them):
|
|
|
|
call ale#assert#SetUpLinterTest('c', 'clang')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/hpp_file_project/subdir/file.c')
|
|
|
|
let g:ale_c_clang_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'clang',
|
|
|
|
\ ale#Escape('clang')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c -fsyntax-only'
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir'))
|
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'))
|
|
|
|
|
2018-08-02 22:44:12 +00:00
|
|
|
Execute(The C++ GCC handler should include 'include' directories for projects with a Makefile):
|
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'gcc')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.cpp')
|
|
|
|
let g:ale_cpp_gcc_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir'))
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
|
|
|
|
\ . ' -'
|
|
|
|
|
|
|
|
Execute(The C++ GCC handler should include 'include' directories for projects with a configure file):
|
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'gcc')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/configure_project/subdir/file.cpp')
|
|
|
|
let g:ale_cpp_gcc_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir'))
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
|
|
|
|
\ . ' -'
|
|
|
|
|
|
|
|
Execute(The C++ GCC handler should include root directories for projects with .h files in them):
|
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'gcc')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/h_file_project/subdir/file.cpp')
|
|
|
|
let g:ale_cpp_gcc_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
|
|
|
|
\ . ' -'
|
|
|
|
|
|
|
|
Execute(The C++ GCC handler should include root directories for projects with .hpp files in them):
|
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'gcc')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/hpp_file_project/subdir/file.cpp')
|
|
|
|
let g:ale_cpp_gcc_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'gcc',
|
|
|
|
\ ale#Escape('gcc')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir'))
|
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++ Clang handler should include 'include' directories for projects with a Makefile):
|
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'clang')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.cpp')
|
|
|
|
let g:ale_cpp_clang_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'clang++',
|
|
|
|
\ ale#Escape('clang++')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c++ -fsyntax-only'
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir'))
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
|
|
|
|
\ . ' -'
|
|
|
|
|
|
|
|
Execute(The C++ Clang handler should include 'include' directories for projects with a configure file):
|
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'clang')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/configure_project/subdir/file.cpp')
|
|
|
|
let g:ale_cpp_clang_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'clang++',
|
|
|
|
\ ale#Escape('clang++')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c++ -fsyntax-only'
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir'))
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
|
|
|
|
\ . ' -'
|
|
|
|
|
|
|
|
Execute(The C++ Clang handler should include root directories for projects with .h files in them):
|
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'clang')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/h_file_project/subdir/file.cpp')
|
|
|
|
let g:ale_cpp_clang_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'clang++',
|
|
|
|
\ ale#Escape('clang++')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c++ -fsyntax-only'
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
|
2018-08-02 22:44:12 +00:00
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
|
|
|
|
\ . ' -'
|
|
|
|
|
|
|
|
Execute(The C++ Clang handler should include root directories for projects with .hpp files in them):
|
|
|
|
call ale#assert#SetUpLinterTest('cpp', 'clang')
|
|
|
|
call ale#test#SetFilename('../test_c_projects/hpp_file_project/subdir/file.cpp')
|
|
|
|
let g:ale_cpp_clang_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'clang++',
|
|
|
|
\ ale#Escape('clang++')
|
2019-05-20 12:00:32 +00:00
|
|
|
\ . ' -S -x c++ -fsyntax-only'
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir'))
|
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'))
|
|
|
|
|