summaryrefslogtreecommitdiff
path: root/test/command_callback
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-08-02 23:44:12 +0100
committerw0rp <devw0rp@gmail.com>2018-08-02 23:44:12 +0100
commit217284360d35711b751859ed27a7a3c3da300e85 (patch)
tree4b26a84b397e3ac15a8b13a572b1f9a50312dbab /test/command_callback
parent9ef266d050d698c3ed3be3456ce6a5da5755d5ef (diff)
downloadale-217284360d35711b751859ed27a7a3c3da300e85.zip
Simplify the code for most linters and tests with closures
Diffstat (limited to 'test/command_callback')
-rw-r--r--test/command_callback/test_c_flawfinder_command_callbacks.vader2
-rw-r--r--test/command_callback/test_c_import_paths.vader223
-rw-r--r--test/command_callback/test_cuda_nvcc_command_callbacks.vader6
-rw-r--r--test/command_callback/test_elm_make_command_callback.vader32
-rw-r--r--test/command_callback/test_fsc_command_callback.vader2
-rw-r--r--test/command_callback/test_gfortran_command_callback.vader8
-rw-r--r--test/command_callback/test_luac_command_callback.vader4
-rw-r--r--test/command_callback/test_luacheck_command_callback.vader4
-rw-r--r--test/command_callback/test_mercury_mmc_command_callback.vader6
-rw-r--r--test/command_callback/test_nasm_nasm_command_callbacks.vader2
-rw-r--r--test/command_callback/test_phpcs_command_callback.vader29
-rw-r--r--test/command_callback/test_scalac_command_callback.vader2
-rw-r--r--test/command_callback/test_swaglint_command_callback.vader8
-rw-r--r--test/command_callback/test_terraform_tflint_command_callback.vader9
14 files changed, 318 insertions, 19 deletions
diff --git a/test/command_callback/test_c_flawfinder_command_callbacks.vader b/test/command_callback/test_c_flawfinder_command_callbacks.vader
index 44573ff5..38385e2b 100644
--- a/test/command_callback/test_c_flawfinder_command_callbacks.vader
+++ b/test/command_callback/test_c_flawfinder_command_callbacks.vader
@@ -13,7 +13,7 @@ Execute(The minlevel of flawfinder should be configurable):
AssertLinter 'flawfinder', ale#Escape('flawfinder') . ' -CDQS --minlevel=8 %t'
Execute(Additional flawfinder options should be configurable):
- let b:ale_c_flawfinder_options = ' --foobar'
+ let b:ale_c_flawfinder_options = '--foobar'
AssertLinter 'flawfinder',
\ ale#Escape('flawfinder') . ' -CDQS --foobar --minlevel=1 %t'
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'))
diff --git a/test/command_callback/test_cuda_nvcc_command_callbacks.vader b/test/command_callback/test_cuda_nvcc_command_callbacks.vader
index 9e2b5ac6..4578d052 100644
--- a/test/command_callback/test_cuda_nvcc_command_callbacks.vader
+++ b/test/command_callback/test_cuda_nvcc_command_callbacks.vader
@@ -12,3 +12,9 @@ Execute(The executable should be configurable):
AssertLinter 'foobar',
\ ale#Escape('foobar') . ' -cuda -std=c++11 %s -o ' . g:ale#util#nul_file
+
+Execute(The options should be configurable):
+ let g:ale_cuda_nvcc_options = '--foobar'
+
+ AssertLinter 'nvcc',
+ \ ale#Escape('nvcc') . ' -cuda --foobar %s -o ' . g:ale#util#nul_file
diff --git a/test/command_callback/test_elm_make_command_callback.vader b/test/command_callback/test_elm_make_command_callback.vader
new file mode 100644
index 00000000..6d95676f
--- /dev/null
+++ b/test/command_callback/test_elm_make_command_callback.vader
@@ -0,0 +1,32 @@
+Before:
+ call ale#assert#SetUpLinterTest('elm', 'make')
+
+After:
+ unlet! g:executable
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(should get valid executable with default params):
+ call ale#test#SetFilename('../elm-test-files/app/testfile.elm')
+
+ let g:executable = ale#path#Simplify(g:dir . '/../elm-test-files/app/node_modules/.bin/elm')
+
+ AssertLinter g:executable,
+ \ ale#Escape(g:executable) . ' make --report=json --output=/dev/null %t'
+
+Execute(should get valid executable with 'use_global' params):
+ let g:ale_elm_make_use_global = 1
+
+ call ale#test#SetFilename('../elm-test-files/app/testfile.elm')
+
+ AssertLinter 'elm',
+ \ ale#Escape('elm') . ' make --report=json --output=/dev/null %t'
+
+Execute(should get valid executable with 'use_global' and 'executable' params):
+ let g:ale_elm_make_executable = 'other-elm'
+ let g:ale_elm_make_use_global = 1
+
+ call ale#test#SetFilename('../elm-test-files/app/testfile.elm')
+
+ AssertLinter 'other-elm',
+ \ ale#Escape('other-elm') . ' make --report=json --output=/dev/null %t'
diff --git a/test/command_callback/test_fsc_command_callback.vader b/test/command_callback/test_fsc_command_callback.vader
index 5fb5e7fa..278e7c16 100644
--- a/test/command_callback/test_fsc_command_callback.vader
+++ b/test/command_callback/test_fsc_command_callback.vader
@@ -10,4 +10,4 @@ Execute(The default executable and command should be correct):
Given scala.sbt(An empty SBT file):
Execute(fsc should not be run for sbt files):
- AssertLinter '', ''
+ AssertLinterNotExecuted
diff --git a/test/command_callback/test_gfortran_command_callback.vader b/test/command_callback/test_gfortran_command_callback.vader
index a6ab50cd..3e6ef951 100644
--- a/test/command_callback/test_gfortran_command_callback.vader
+++ b/test/command_callback/test_gfortran_command_callback.vader
@@ -5,20 +5,20 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The fortran gcc command callback should return the correct default string):
- AssertLinter 'gcc', 'gcc -S -x f95 -fsyntax-only -ffree-form -Wall -'
+ AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffree-form -Wall -'
Execute(The fortran gcc command callback should let you set options):
let g:ale_fortran_gcc_options = '-Wotherthings'
- AssertLinter 'gcc', 'gcc -S -x f95 -fsyntax-only -ffree-form -Wotherthings -'
+ AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffree-form -Wotherthings -'
Execute(The fortran gcc command callback should let you use -ffixed-form):
let g:ale_fortran_gcc_use_free_form = 0
- AssertLinter 'gcc', 'gcc -S -x f95 -fsyntax-only -ffixed-form -Wall -'
+ AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffixed-form -Wall -'
Execute(The fortran executable should be configurable):
let g:ale_fortran_gcc_executable = 'gfortran'
AssertLinter 'gfortran',
- \ 'gfortran -S -x f95 -fsyntax-only -ffree-form -Wall -'
+ \ ale#Escape('gfortran') . ' -S -x f95 -fsyntax-only -ffree-form -Wall -'
diff --git a/test/command_callback/test_luac_command_callback.vader b/test/command_callback/test_luac_command_callback.vader
index 8a2345ec..55f39cba 100644
--- a/test/command_callback/test_luac_command_callback.vader
+++ b/test/command_callback/test_luac_command_callback.vader
@@ -5,9 +5,9 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The default command should be correct):
- AssertLinter 'luac', ale#Escape('luac') . ' -p - '
+ AssertLinter 'luac', ale#Escape('luac') . ' -p -'
Execute(The luac executable should be configurable):
let g:ale_lua_luac_executable = 'luac.sh'
- AssertLinter 'luac.sh', ale#Escape('luac.sh') . ' -p - '
+ AssertLinter 'luac.sh', ale#Escape('luac.sh') . ' -p -'
diff --git a/test/command_callback/test_luacheck_command_callback.vader b/test/command_callback/test_luacheck_command_callback.vader
index 58d0cdc0..f0ef221c 100644
--- a/test/command_callback/test_luacheck_command_callback.vader
+++ b/test/command_callback/test_luacheck_command_callback.vader
@@ -6,7 +6,7 @@ After:
Execute(The lua luacheck command callback should return the correct default string):
AssertLinter 'luacheck',
- \ ale#Escape('luacheck') . ' --formatter plain --codes --filename %s -'
+ \ ale#Escape('luacheck') . ' --formatter plain --codes --filename %s -'
Execute(The lua luacheck command callback should let you set options):
let g:ale_lua_luacheck_options = '--config filename'
@@ -20,4 +20,4 @@ Execute(The luacheck executable should be configurable):
let g:ale_lua_luacheck_executable = 'luacheck.sh'
AssertLinter 'luacheck.sh',
- \ ale#Escape('luacheck.sh') . ' --formatter plain --codes --filename %s -'
+ \ ale#Escape('luacheck.sh') . ' --formatter plain --codes --filename %s -'
diff --git a/test/command_callback/test_mercury_mmc_command_callback.vader b/test/command_callback/test_mercury_mmc_command_callback.vader
index 2948e799..ab61fddf 100644
--- a/test/command_callback/test_mercury_mmc_command_callback.vader
+++ b/test/command_callback/test_mercury_mmc_command_callback.vader
@@ -8,18 +8,18 @@ After:
Execute(The default command should be correct):
AssertLinter 'mmc',
\ ale#path#BufferCdString(bufnr(''))
- \ . 'mmc --errorcheck-only --make --output-compile-error-lines 100 dummy'
+ \ . ale#Escape('mmc') . ' --errorcheck-only --make --output-compile-error-lines 100 dummy'
Execute(The executable should be configurable):
let b:ale_mercury_mmc_executable = 'foo'
AssertLinter 'foo',
\ ale#path#BufferCdString(bufnr(''))
- \ . 'foo --errorcheck-only --make --output-compile-error-lines 100 dummy'
+ \ . ale#Escape('foo') . ' --errorcheck-only --make --output-compile-error-lines 100 dummy'
Execute(The options should be configurable):
let b:ale_mercury_mmc_options = '--bar'
AssertLinter 'mmc',
\ ale#path#BufferCdString(bufnr(''))
- \ . 'mmc --errorcheck-only --bar dummy'
+ \ . ale#Escape('mmc') . ' --errorcheck-only --bar dummy'
diff --git a/test/command_callback/test_nasm_nasm_command_callbacks.vader b/test/command_callback/test_nasm_nasm_command_callbacks.vader
index 4e0cf608..0d3e572a 100644
--- a/test/command_callback/test_nasm_nasm_command_callbacks.vader
+++ b/test/command_callback/test_nasm_nasm_command_callbacks.vader
@@ -2,7 +2,7 @@ Before:
call ale#assert#SetUpLinterTest('nasm', 'nasm')
let b:command_tail =
- \ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' %s'
+ \ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' %s'
let b:command_tail_opt =
\ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w+orphan-labels %s'
diff --git a/test/command_callback/test_phpcs_command_callback.vader b/test/command_callback/test_phpcs_command_callback.vader
new file mode 100644
index 00000000..941a92d6
--- /dev/null
+++ b/test/command_callback/test_phpcs_command_callback.vader
@@ -0,0 +1,29 @@
+Before:
+ call ale#assert#SetUpLinterTest('php', 'phpcs')
+
+After:
+ unlet! g:executable
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(The local phpcs executable should be used):
+ call ale#test#SetFilename('../phpcs-test-files/project-with-phpcs/foo/test.php')
+
+ let g:executable = ale#path#Simplify(g:dir . '/../phpcs-test-files/project-with-phpcs/vendor/bin/phpcs')
+
+ AssertLinter g:executable,
+ \ ale#Escape(g:executable) . ' -s --report=emacs --stdin-path=%s'
+
+Execute(use_global should override local executable detection):
+ let g:ale_php_phpcs_use_global = 1
+
+ call ale#test#SetFilename('../phpcs-test-files/project-with-phpcs/foo/test.php')
+
+ AssertLinter 'phpcs',
+ \ ale#Escape('phpcs') . ' -s --report=emacs --stdin-path=%s'
+
+Execute(Projects without local executables should use the global one):
+ call ale#test#SetFilename('../phpcs-test-files/project-without-phpcs/foo/test.php')
+
+ AssertLinter 'phpcs',
+ \ ale#Escape('phpcs') . ' -s --report=emacs --stdin-path=%s'
diff --git a/test/command_callback/test_scalac_command_callback.vader b/test/command_callback/test_scalac_command_callback.vader
index 115731b3..ea5ae109 100644
--- a/test/command_callback/test_scalac_command_callback.vader
+++ b/test/command_callback/test_scalac_command_callback.vader
@@ -10,4 +10,4 @@ Execute(The default executable and command should be correct):
Given scala.sbt(An empty SBT file):
Execute(scalac should not be run for sbt files):
- AssertLinter '', ''
+ AssertLinterNotExecuted
diff --git a/test/command_callback/test_swaglint_command_callback.vader b/test/command_callback/test_swaglint_command_callback.vader
index fe8fb722..68fb1406 100644
--- a/test/command_callback/test_swaglint_command_callback.vader
+++ b/test/command_callback/test_swaglint_command_callback.vader
@@ -5,25 +5,25 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The yaml swaglint command callback should return the correct default string):
- AssertLinter 'swaglint', 'swaglint -r compact --stdin'
+ AssertLinter 'swaglint', ale#Escape('swaglint') . ' -r compact --stdin'
Execute(The yaml swaglint command callback should be configurable):
let g:ale_yaml_swaglint_executable = '~/.local/bin/swaglint'
AssertLinter '~/.local/bin/swaglint',
- \ '~/.local/bin/swaglint -r compact --stdin'
+ \ ale#Escape('~/.local/bin/swaglint') . ' -r compact --stdin'
Execute(The yaml swaglint command callback should allow a global installation to be used):
let g:ale_yaml_swaglint_executable = '/usr/local/bin/swaglint'
let g:ale_yaml_swaglint_use_global = 1
AssertLinter '/usr/local/bin/swaglint',
- \ '/usr/local/bin/swaglint -r compact --stdin'
+ \ ale#Escape('/usr/local/bin/swaglint') . ' -r compact --stdin'
Execute(The yaml swaglint command callback should allow a local installation to be used):
call ale#test#SetFilename('swaglint_paths/docs/swagger.yaml')
AssertLinter
\ ale#path#Simplify(g:dir . '/swaglint_paths/node_modules/.bin/swaglint'),
- \ ale#path#Simplify(g:dir . '/swaglint_paths/node_modules/.bin/swaglint')
+ \ ale#Escape(ale#path#Simplify(g:dir . '/swaglint_paths/node_modules/.bin/swaglint'))
\ . ' -r compact --stdin'
diff --git a/test/command_callback/test_terraform_tflint_command_callback.vader b/test/command_callback/test_terraform_tflint_command_callback.vader
index c32d9bcf..0cef0176 100644
--- a/test/command_callback/test_terraform_tflint_command_callback.vader
+++ b/test/command_callback/test_terraform_tflint_command_callback.vader
@@ -17,3 +17,12 @@ Execute(Overriding options should work):
let g:ale_terraform_tflint_options = '--whatever'
AssertLinter 'fnord', ale#Escape('fnord') . ' --whatever -f json %t'
+
+Execute(Configuration files should be found):
+ call ale#test#SetFilename('../tflint-test-files/foo/bar.tf')
+
+ AssertLinter 'tflint',
+ \ ale#Escape('tflint')
+ \ . ' --config '
+ \ . ale#Escape(ale#path#Simplify(g:dir . '/../tflint-test-files/foo/.tflint.hcl'))
+ \ . ' -f json %t'