mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-30 16:14:30 +08:00
Simplify the code for most linters and tests with closures
This commit is contained in:
@@ -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'
|
||||
|
||||
223
test/command_callback/test_c_import_paths.vader
Normal file
223
test/command_callback/test_c_import_paths.vader
Normal file
@@ -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'))
|
||||
@@ -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
|
||||
|
||||
32
test/command_callback/test_elm_make_command_callback.vader
Normal file
32
test/command_callback/test_elm_make_command_callback.vader
Normal file
@@ -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'
|
||||
@@ -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
|
||||
|
||||
@@ -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 -'
|
||||
|
||||
@@ -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 -'
|
||||
|
||||
@@ -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 -'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
29
test/command_callback/test_phpcs_command_callback.vader
Normal file
29
test/command_callback/test_phpcs_command_callback.vader
Normal file
@@ -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'
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user