summaryrefslogtreecommitdiff
path: root/test/command_callback/test_c_import_paths.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2020-08-20 01:46:29 +0100
committerw0rp <devw0rp@gmail.com>2020-08-20 01:49:14 +0100
commit2b785688ead505dcbc1007374d3dca9914aa247a (patch)
tree6ca8b42b3eedc17e60931a6d22f61d71e8e142e3 /test/command_callback/test_c_import_paths.vader
parent4d42ebc160d7cccd19c37ffe2ccb97752794be37 (diff)
downloadale-2b785688ead505dcbc1007374d3dca9914aa247a.zip
#3299 Merge gcc and clang into a cc linter
Users can easily be confused when they set some options for a C or C++ compiler, and another compiler is run with different options, which still reports errors. To remedy this, the existing `gcc` and `clang` linters have been replaced with a `cc` linter that will run either compiler. This is a breaking change for ALE v3.0.0.
Diffstat (limited to 'test/command_callback/test_c_import_paths.vader')
-rw-r--r--test/command_callback/test_c_import_paths.vader154
1 files changed, 34 insertions, 120 deletions
diff --git a/test/command_callback/test_c_import_paths.vader b/test/command_callback/test_c_import_paths.vader
index e6102998..8384a659 100644
--- a/test/command_callback/test_c_import_paths.vader
+++ b/test/command_callback/test_c_import_paths.vader
@@ -7,6 +7,7 @@ Before:
Save g:__ale_c_project_filenames
let g:original_project_filenames = g:__ale_c_project_filenames
+ let g:executable_map = {}
" Remove the .git/HEAD dir for C import paths for these tests.
" The tests run inside of a git repo.
@@ -18,17 +19,26 @@ Before:
let g:ale_c_parse_compile_commands = 0
let g:ale_c_parse_makefile = 0
+ runtime autoload/ale/engine.vim
+
+ function! ale#engine#IsExecutable(buffer, executable) abort
+ return has_key(g:executable_map, a:executable)
+ endfunction
+
After:
Restore
unlet! g:original_project_filenames
+ unlet! g:executable_map
+
+ runtime autoload/ale/engine.vim
call ale#assert#TearDownLinterTest()
-Execute(The C GCC handler should include 'include' directories for projects with a Makefile):
- call ale#assert#SetUpLinterTest('c', 'gcc')
+Execute(The C cc linter should include 'include' directories for projects with a Makefile):
+ call ale#assert#SetUpLinterTest('c', 'cc')
call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.c')
- let g:ale_c_gcc_options = ''
+ let g:ale_c_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -37,10 +47,10 @@ Execute(The C GCC handler should include 'include' directories for projects with
\ . ' -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')
+Execute(The C cc linter should include 'include' directories for projects with a configure file):
+ call ale#assert#SetUpLinterTest('c', 'cc')
call ale#test#SetFilename('../test_c_projects/configure_project/subdir/file.c')
- let g:ale_c_gcc_options = ''
+ let g:ale_c_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -49,10 +59,10 @@ Execute(The C GCC handler should include 'include' directories for projects with
\ . ' -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')
+Execute(The C cc linter should include root directories for projects with .h files in them):
+ call ale#assert#SetUpLinterTest('c', 'cc')
call ale#test#SetFilename('../test_c_projects/h_file_project/subdir/file.c')
- let g:ale_c_gcc_options = ''
+ let g:ale_c_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -61,10 +71,10 @@ Execute(The C GCC handler should include root directories for projects with .h f
\ . ' -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')
+Execute(The C cc linter should include root directories for projects with .hpp files in them):
+ call ale#assert#SetUpLinterTest('c', 'cc')
call ale#test#SetFilename('../test_c_projects/hpp_file_project/subdir/file.c')
- let g:ale_c_gcc_options = ''
+ let g:ale_c_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -73,54 +83,6 @@ Execute(The C GCC handler should include root directories for projects with .hpp
\ . ' -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')
- \ . ' -S -x c -fsyntax-only'
- \ . ' -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 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')
- \ . ' -S -x c -fsyntax-only'
- \ . ' -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'))
- \ . ' -'
-
-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')
- \ . ' -S -x c -fsyntax-only'
- \ . ' -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'))
- \ . ' -'
-
-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')
- \ . ' -S -x c -fsyntax-only'
- \ . ' -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'))
- \ . ' -'
-
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')
@@ -131,10 +93,10 @@ Execute(The C ClangTidy handler should include 'include' directories for project
\ . ' %s '
\ . '-- -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 Makefile):
- call ale#assert#SetUpLinterTest('cpp', 'gcc')
+Execute(The C++ cc linter should include 'include' directories for projects with a Makefile):
+ call ale#assert#SetUpLinterTest('cpp', 'cc')
call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.cpp')
- let g:ale_cpp_gcc_options = ''
+ let g:ale_cpp_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -143,10 +105,10 @@ Execute(The C++ GCC handler should include 'include' directories for projects wi
\ . ' -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')
+Execute(The C++ cc linter should include 'include' directories for projects with a configure file):
+ call ale#assert#SetUpLinterTest('cpp', 'cc')
call ale#test#SetFilename('../test_c_projects/configure_project/subdir/file.cpp')
- let g:ale_cpp_gcc_options = ''
+ let g:ale_cpp_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -155,10 +117,10 @@ Execute(The C++ GCC handler should include 'include' directories for projects wi
\ . ' -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')
+Execute(The C++ cc linter should include root directories for projects with .h files in them):
+ call ale#assert#SetUpLinterTest('cpp', 'cc')
call ale#test#SetFilename('../test_c_projects/h_file_project/subdir/file.cpp')
- let g:ale_cpp_gcc_options = ''
+ let g:ale_cpp_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -167,10 +129,10 @@ Execute(The C++ GCC handler should include root directories for projects with .h
\ . ' -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')
+Execute(The C++ cc linter should include root directories for projects with .hpp files in them):
+ call ale#assert#SetUpLinterTest('cpp', 'cc')
call ale#test#SetFilename('../test_c_projects/hpp_file_project/subdir/file.cpp')
- let g:ale_cpp_gcc_options = ''
+ let g:ale_cpp_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -179,54 +141,6 @@ Execute(The C++ GCC handler should include root directories for projects with .h
\ . ' -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++')
- \ . ' -S -x c++ -fsyntax-only'
- \ . ' -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++ 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++')
- \ . ' -S -x c++ -fsyntax-only'
- \ . ' -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'))
- \ . ' -'
-
-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++')
- \ . ' -S -x c++ -fsyntax-only'
- \ . ' -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'))
- \ . ' -'
-
-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++')
- \ . ' -S -x c++ -fsyntax-only'
- \ . ' -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'))
- \ . ' -'
-
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')