diff options
author | w0rp <devw0rp@gmail.com> | 2018-08-02 23:44:12 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-08-02 23:44:12 +0100 |
commit | 217284360d35711b751859ed27a7a3c3da300e85 (patch) | |
tree | 4b26a84b397e3ac15a8b13a572b1f9a50312dbab /test/command_callback/test_c_import_paths.vader | |
parent | 9ef266d050d698c3ed3be3456ce6a5da5755d5ef (diff) | |
download | ale-217284360d35711b751859ed27a7a3c3da300e85.zip |
Simplify the code for most linters and tests with closures
Diffstat (limited to 'test/command_callback/test_c_import_paths.vader')
-rw-r--r-- | test/command_callback/test_c_import_paths.vader | 223 |
1 files changed, 223 insertions, 0 deletions
diff --git a/test/command_callback/test_c_import_paths.vader b/test/command_callback/test_c_import_paths.vader new file mode 100644 index 00000000..80fff57b --- /dev/null +++ b/test/command_callback/test_c_import_paths.vader @@ -0,0 +1,223 @@ +Before: + " Make sure the c.vim file is loaded first. + call ale#c#FindProjectRoot(bufnr('')) + + 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''' + \) + + let g:ale_c_parse_makefile = 0 + +After: + 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') + \ . ' -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 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') + \ . ' -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 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') + \ . ' -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 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') + \ . ' -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 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++ 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') + \ . ' -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++ 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') + \ . ' -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++ 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') + \ . ' -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++ 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') + \ . ' -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++ 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') + + AssertLinter 'clang-tidy', + \ ale#Escape('clang-tidy') + \ . ' -checks=' . ale#Escape('*') . ' %s ' + \ . '-p ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/json_project/build')) |