2017-05-31 15:01:40 -04:00
|
|
|
Before:
|
2018-07-23 17:03:28 -04:00
|
|
|
" Make sure the c.vim file is loaded first.
|
|
|
|
call ale#c#FindProjectRoot(bufnr(''))
|
|
|
|
|
2017-05-31 15:01:40 -04:00
|
|
|
Save g:ale_c_gcc_options
|
|
|
|
Save g:ale_c_clang_options
|
|
|
|
Save g:ale_cpp_gcc_options
|
|
|
|
Save g:ale_cpp_clang_options
|
2018-07-23 17:03:28 -04:00
|
|
|
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'''
|
|
|
|
\)
|
2017-05-31 15:01:40 -04:00
|
|
|
|
2017-07-09 17:43:25 -04:00
|
|
|
call ale#test#SetDirectory('/testplugin/test')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
let g:ale_c_gcc_options = ''
|
|
|
|
let g:ale_c_clang_options = ''
|
|
|
|
let g:ale_cpp_gcc_options = ''
|
|
|
|
let g:ale_cpp_clang_options = ''
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
2018-07-23 17:03:28 -04:00
|
|
|
unlet! g:original_project_filenames
|
|
|
|
|
2017-07-09 17:43:25 -04:00
|
|
|
call ale#test#RestoreDirectory()
|
2017-05-31 15:01:40 -04:00
|
|
|
call ale#linter#Reset()
|
|
|
|
|
|
|
|
Execute(The C GCC handler should include 'include' directories for projects with a Makefile):
|
|
|
|
runtime! ale_linters/c/gcc.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 17:41:15 -04:00
|
|
|
\ ale#Escape('gcc')
|
|
|
|
\ . ' -S -x c -fsyntax-only '
|
2017-12-19 13:23:09 -05: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')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-20 16:49:31 -04:00
|
|
|
\ , ale_linters#c#gcc#GetCommand(bufnr(''), [])
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
Execute(The C GCC handler should include 'include' directories for projects with a configure file):
|
|
|
|
runtime! ale_linters/c/gcc.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/configure_project/subdir/file.c')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 17:41:15 -04:00
|
|
|
\ ale#Escape('gcc')
|
|
|
|
\ . ' -S -x c -fsyntax-only '
|
2017-12-19 13:23:09 -05:00
|
|
|
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/configure_project/subdir')) . ' '
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/configure_project/include')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-20 16:49:31 -04:00
|
|
|
\ , ale_linters#c#gcc#GetCommand(bufnr(''), [])
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
Execute(The C GCC handler should include root directories for projects with .h files in them):
|
|
|
|
runtime! ale_linters/c/gcc.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/h_file_project/subdir/file.c')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 17:41:15 -04:00
|
|
|
\ ale#Escape('gcc')
|
|
|
|
\ . ' -S -x c -fsyntax-only '
|
2017-12-19 13:23:09 -05:00
|
|
|
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-20 16:49:31 -04:00
|
|
|
\ , ale_linters#c#gcc#GetCommand(bufnr(''), [])
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
Execute(The C GCC handler should include root directories for projects with .hpp files in them):
|
|
|
|
runtime! ale_linters/c/gcc.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/hpp_file_project/subdir/file.c')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 17:41:15 -04:00
|
|
|
\ ale#Escape('gcc')
|
|
|
|
\ . ' -S -x c -fsyntax-only '
|
2017-12-19 13:23:09 -05:00
|
|
|
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-20 16:49:31 -04:00
|
|
|
\ , ale_linters#c#gcc#GetCommand(bufnr(''), [])
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
Execute(The C Clang handler should include 'include' directories for projects with a Makefile):
|
|
|
|
runtime! ale_linters/c/clang.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 16:37:10 -04:00
|
|
|
\ ale#Escape('clang')
|
|
|
|
\ . ' -S -x c -fsyntax-only '
|
2017-12-19 13:23:09 -05: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')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-20 16:49:31 -04:00
|
|
|
\ , ale_linters#c#clang#GetCommand(bufnr(''), [])
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
Execute(The C Clang handler should include 'include' directories for projects with a configure file):
|
|
|
|
runtime! ale_linters/c/clang.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/h_file_project/subdir/file.c')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 16:37:10 -04:00
|
|
|
\ ale#Escape('clang')
|
|
|
|
\ . ' -S -x c -fsyntax-only '
|
2017-12-19 13:23:09 -05:00
|
|
|
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-20 16:49:31 -04:00
|
|
|
\ , ale_linters#c#clang#GetCommand(bufnr(''), [])
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
Execute(The C Clang handler should include root directories for projects with .h files in them):
|
|
|
|
runtime! ale_linters/c/clang.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/h_file_project/subdir/file.c')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 16:37:10 -04:00
|
|
|
\ ale#Escape('clang')
|
|
|
|
\ . ' -S -x c -fsyntax-only '
|
2017-12-19 13:23:09 -05:00
|
|
|
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-20 16:49:31 -04:00
|
|
|
\ , ale_linters#c#clang#GetCommand(bufnr(''), [])
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
Execute(The C Clang handler should include root directories for projects with .hpp files in them):
|
|
|
|
runtime! ale_linters/c/clang.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/hpp_file_project/subdir/file.c')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 16:37:10 -04:00
|
|
|
\ ale#Escape('clang')
|
|
|
|
\ . ' -S -x c -fsyntax-only '
|
2017-12-19 13:23:09 -05:00
|
|
|
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-20 16:49:31 -04:00
|
|
|
\ , ale_linters#c#clang#GetCommand(bufnr(''), [])
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
Execute(The C++ GCC handler should include 'include' directories for projects with a Makefile):
|
|
|
|
runtime! ale_linters/cpp/gcc.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.cpp')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 17:41:15 -04:00
|
|
|
\ ale#Escape('gcc')
|
|
|
|
\ . ' -S -x c++ -fsyntax-only '
|
2017-12-19 13:23:09 -05: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')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-27 14:24:22 -04:00
|
|
|
\ , ale_linters#cpp#gcc#GetCommand(bufnr(''), [])
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
Execute(The C++ GCC handler should include 'include' directories for projects with a configure file):
|
|
|
|
runtime! ale_linters/cpp/gcc.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/configure_project/subdir/file.cpp')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 17:41:15 -04:00
|
|
|
\ ale#Escape('gcc')
|
|
|
|
\ . ' -S -x c++ -fsyntax-only '
|
2017-12-19 13:23:09 -05:00
|
|
|
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/configure_project/subdir')) . ' '
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/configure_project/include')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-27 14:24:22 -04:00
|
|
|
\ , ale_linters#cpp#gcc#GetCommand(bufnr(''), [])
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
Execute(The C++ GCC handler should include root directories for projects with .h files in them):
|
|
|
|
runtime! ale_linters/cpp/gcc.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/h_file_project/subdir/file.cpp')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 17:41:15 -04:00
|
|
|
\ ale#Escape('gcc')
|
|
|
|
\ . ' -S -x c++ -fsyntax-only '
|
2017-12-19 13:23:09 -05:00
|
|
|
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-27 14:24:22 -04:00
|
|
|
\ , ale_linters#cpp#gcc#GetCommand(bufnr(''), [])
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
Execute(The C++ GCC handler should include root directories for projects with .hpp files in them):
|
|
|
|
runtime! ale_linters/cpp/gcc.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/hpp_file_project/subdir/file.cpp')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 17:41:15 -04:00
|
|
|
\ ale#Escape('gcc')
|
|
|
|
\ . ' -S -x c++ -fsyntax-only '
|
2017-12-19 13:23:09 -05:00
|
|
|
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-27 14:24:22 -04:00
|
|
|
\ , ale_linters#cpp#gcc#GetCommand(bufnr(''), [])
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
Execute(The C++ Clang handler should include 'include' directories for projects with a Makefile):
|
|
|
|
runtime! ale_linters/cpp/clang.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.cpp')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 16:37:10 -04:00
|
|
|
\ ale#Escape('clang++')
|
|
|
|
\ . ' -S -x c++ -fsyntax-only '
|
2017-12-19 13:23:09 -05: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')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-27 14:24:22 -04:00
|
|
|
\ , ale_linters#cpp#clang#GetCommand(bufnr(''), [])
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
Execute(The C++ Clang handler should include 'include' directories for projects with a configure file):
|
|
|
|
runtime! ale_linters/cpp/clang.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/configure_project/subdir/file.cpp')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 16:37:10 -04:00
|
|
|
\ ale#Escape('clang++')
|
|
|
|
\ . ' -S -x c++ -fsyntax-only '
|
2017-12-19 13:23:09 -05:00
|
|
|
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/configure_project/subdir')) . ' '
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/configure_project/include')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-27 14:24:22 -04:00
|
|
|
\ , ale_linters#cpp#clang#GetCommand(bufnr(''), [])
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
Execute(The C++ Clang handler should include root directories for projects with .h files in them):
|
|
|
|
runtime! ale_linters/cpp/clang.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/h_file_project/subdir/file.cpp')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 16:37:10 -04:00
|
|
|
\ ale#Escape('clang++')
|
|
|
|
\ . ' -S -x c++ -fsyntax-only '
|
2017-12-19 13:23:09 -05:00
|
|
|
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-27 14:24:22 -04:00
|
|
|
\ , ale_linters#cpp#clang#GetCommand(bufnr(''), [])
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
Execute(The C++ Clang handler should include root directories for projects with .hpp files in them):
|
|
|
|
runtime! ale_linters/cpp/clang.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/hpp_file_project/subdir/file.cpp')
|
2017-05-31 15:01:40 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 16:37:10 -04:00
|
|
|
\ ale#Escape('clang++')
|
|
|
|
\ . ' -S -x c++ -fsyntax-only '
|
2017-12-19 13:23:09 -05:00
|
|
|
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
|
|
|
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
|
2017-05-31 15:01:40 -04:00
|
|
|
\ . ' -'
|
2018-03-27 14:24:22 -04:00
|
|
|
\ , ale_linters#cpp#clang#GetCommand(bufnr(''), [])
|
2017-06-24 07:38:16 -04:00
|
|
|
|
|
|
|
Execute(The C++ ClangTidy handler should include json folders for projects with suitable build directory in them):
|
|
|
|
runtime! ale_linters/cpp/clangtidy.vim
|
|
|
|
|
2017-06-25 16:33:15 -04:00
|
|
|
call ale#test#SetFilename('test_c_projects/json_project/subdir/file.cpp')
|
2017-06-24 07:38:16 -04:00
|
|
|
|
|
|
|
AssertEqual
|
2017-07-16 19:07:18 -04:00
|
|
|
\ ale#Escape('clang-tidy')
|
2017-10-23 18:09:40 -04:00
|
|
|
\ . ' -checks=' . ale#Escape('*') . ' %s '
|
2017-12-19 13:23:09 -05:00
|
|
|
\ . '-p ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/json_project/build'))
|
2017-06-24 07:38:16 -04:00
|
|
|
\ , ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
|