summaryrefslogtreecommitdiff
path: root/test/command_callback
diff options
context:
space:
mode:
Diffstat (limited to 'test/command_callback')
-rw-r--r--test/command_callback/test_ada_gcc_command_callbacks.vader8
-rw-r--r--test/command_callback/test_asm_gcc_command_callbacks.vader2
-rw-r--r--test/command_callback/test_c_cc_command_callbacks.vader55
-rw-r--r--test/command_callback/test_c_clang_command_callbacks.vader20
-rw-r--r--test/command_callback/test_c_gcc_command_callbacks.vader22
-rw-r--r--test/command_callback/test_c_import_paths.vader170
-rw-r--r--test/command_callback/test_cpp_cc_command_callbacks.vader55
-rw-r--r--test/command_callback/test_cpp_clang_command_callbacks.vader19
-rw-r--r--test/command_callback/test_cpp_gcc_command_callbacks.vader20
-rw-r--r--test/command_callback/test_elixir_credo.vader12
-rw-r--r--test/command_callback/test_embertemplatelint_command_callbacks.vader17
-rw-r--r--test/command_callback/test_flake8_command_callback.vader43
-rw-r--r--test/command_callback/test_gobuild_command_callback.vader8
-rw-r--r--test/command_callback/test_gofmt_command_callback.vader3
-rw-r--r--test/command_callback/test_golangci_lint_command_callback.vader10
-rw-r--r--test/command_callback/test_gometalinter_command_callback.vader10
-rw-r--r--test/command_callback/test_gosimple_command_callback.vader7
-rw-r--r--test/command_callback/test_gotype_command_callback.vader7
-rw-r--r--test/command_callback/test_govet_command_callback.vader8
-rw-r--r--test/command_callback/test_graphql_gqlint_command_callbacks.vader2
-rw-r--r--test/command_callback/test_javac_command_callback.vader31
-rw-r--r--test/command_callback/test_lintr_command_callback.vader6
-rw-r--r--test/command_callback/test_markdown_markdownlint_command_callback.vader13
-rw-r--r--test/command_callback/test_mypy_command_callback.vader6
-rw-r--r--test/command_callback/test_nasm_nasm_command_callbacks.vader7
-rw-r--r--test/command_callback/test_psalm_command_callbacks.vader32
-rw-r--r--test/command_callback/test_pydocstyle_command_callback.vader13
-rw-r--r--test/command_callback/test_pylama_command_callback.vader12
-rw-r--r--test/command_callback/test_pylint_command_callback.vader16
-rw-r--r--test/command_callback/test_pyrex_cython_command_callback.vader12
-rw-r--r--test/command_callback/test_rubocop_command_callback.vader9
-rw-r--r--test/command_callback/test_ruumba_command_callback.vader9
-rw-r--r--test/command_callback/test_shellcheck_command_callback.vader2
-rw-r--r--test/command_callback/test_sqllint_command_callback.vader12
-rw-r--r--test/command_callback/test_standardrb_command_callback.vader9
-rw-r--r--test/command_callback/test_staticcheck_command_callback.vader11
-rw-r--r--test/command_callback/test_swift_swiftformat_command_callbacks.vader25
-rw-r--r--test/command_callback/test_tslint_command_callback.vader6
-rw-r--r--test/command_callback/test_vint_command_callback.vader2
-rw-r--r--test/command_callback/test_vulture_command_callback.vader8
40 files changed, 415 insertions, 324 deletions
diff --git a/test/command_callback/test_ada_gcc_command_callbacks.vader b/test/command_callback/test_ada_gcc_command_callbacks.vader
index de6e355e..906b31a4 100644
--- a/test/command_callback/test_ada_gcc_command_callbacks.vader
+++ b/test/command_callback/test_ada_gcc_command_callbacks.vader
@@ -18,11 +18,10 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The executable should be configurable):
-
AssertLinter 'gcc',
\ ale#Escape('gcc') . ' -x ada -c -gnatc'
\ . ' -o ' . b:out_file
- \ . ' -I ' . ale#Escape(getcwd())
+ \ . ' -I %s:h'
\ . ' -gnatwa -gnatq %t'
let b:ale_ada_gcc_executable = 'foo'
@@ -30,15 +29,14 @@ Execute(The executable should be configurable):
AssertLinter 'foo',
\ ale#Escape('foo') . ' -x ada -c -gnatc'
\ . ' -o ' . b:out_file
- \ . ' -I ' . ale#Escape(getcwd())
+ \ . ' -I %s:h'
\ . ' -gnatwa -gnatq %t'
Execute(The options should be configurable):
-
let g:ale_ada_gcc_options = '--foo --bar'
AssertLinter 'gcc',
\ ale#Escape('gcc') . ' -x ada -c -gnatc'
\ . ' -o ' . b:out_file
- \ . ' -I ' . ale#Escape(getcwd())
+ \ . ' -I %s:h'
\ . ' --foo --bar %t'
diff --git a/test/command_callback/test_asm_gcc_command_callbacks.vader b/test/command_callback/test_asm_gcc_command_callbacks.vader
index 42606ec0..5976b5f2 100644
--- a/test/command_callback/test_asm_gcc_command_callbacks.vader
+++ b/test/command_callback/test_asm_gcc_command_callbacks.vader
@@ -3,7 +3,7 @@ Before:
call ale#test#SetFilename('test.cpp')
let b:command_tail = ' -x assembler'
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
- \ . '-iquote ' . ale#Escape(g:dir)
+ \ . '-iquote %s:h'
\ . ' -Wall -'
After:
diff --git a/test/command_callback/test_c_cc_command_callbacks.vader b/test/command_callback/test_c_cc_command_callbacks.vader
new file mode 100644
index 00000000..c8c2de7d
--- /dev/null
+++ b/test/command_callback/test_c_cc_command_callbacks.vader
@@ -0,0 +1,55 @@
+Before:
+ Save g:ale_c_parse_makefile
+ Save g:ale_history_enabled
+
+ let g:ale_c_parse_makefile = 0
+ let g:ale_history_enabled = 0
+
+ let g:get_cflags_return_value = ''
+ let g:executable_map = {}
+
+ runtime autoload/ale/c.vim
+ runtime autoload/ale/engine.vim
+
+ function! ale#engine#IsExecutable(buffer, executable) abort
+ return has_key(g:executable_map, a:executable)
+ endfunction
+
+ function! ale#c#GetCFlags(buffer, output) abort
+ return g:get_cflags_return_value
+ endfunction
+
+ call ale#assert#SetUpLinterTest('c', 'cc')
+
+ let b:command_tail = ' -S -x c'
+ \ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
+ \ . ' -iquote %s:h'
+ \ . ' -std=c11 -Wall -'
+
+After:
+ unlet! g:get_cflags_return_value
+ unlet! g:executable_map
+ unlet! b:command_tail
+
+ runtime autoload/ale/c.vim
+ runtime autoload/ale/engine.vim
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(clang should be used instead of gcc, if available):
+ let g:executable_map = {'clang': 1}
+
+ AssertLinter 'clang', [ale#Escape('clang') . b:command_tail]
+
+Execute(The executable should be configurable):
+ AssertLinter 'gcc', [ale#Escape('gcc') . b:command_tail]
+
+ let b:ale_c_cc_executable = 'foobar'
+
+ AssertLinter 'foobar', [ale#Escape('foobar') . b:command_tail]
+
+Execute(The -std flag should be replaced by parsed C flags):
+ let b:command_tail = substitute(b:command_tail, 'c11', 'c99 ', '')
+ let g:get_cflags_return_value = '-std=c99'
+
+ AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail
diff --git a/test/command_callback/test_c_clang_command_callbacks.vader b/test/command_callback/test_c_clang_command_callbacks.vader
deleted file mode 100644
index b8c02e4d..00000000
--- a/test/command_callback/test_c_clang_command_callbacks.vader
+++ /dev/null
@@ -1,20 +0,0 @@
-Before:
- Save g:ale_c_parse_makefile
- let g:ale_c_parse_makefile = 0
-
- call ale#assert#SetUpLinterTest('c', 'clang')
- let b:command_tail = ' -S -x c -fsyntax-only -iquote'
- \ . ' ' . ale#Escape(getcwd())
- \ . ' -std=c11 -Wall -'
-
-After:
- unlet! b:command_tail
-
- call ale#assert#TearDownLinterTest()
-
-Execute(The executable should be configurable):
- AssertLinter 'clang', [ale#Escape('clang') . b:command_tail]
-
- let b:ale_c_clang_executable = 'foobar'
-
- AssertLinter 'foobar', [ale#Escape('foobar') . b:command_tail]
diff --git a/test/command_callback/test_c_gcc_command_callbacks.vader b/test/command_callback/test_c_gcc_command_callbacks.vader
deleted file mode 100644
index 2dbb8b7c..00000000
--- a/test/command_callback/test_c_gcc_command_callbacks.vader
+++ /dev/null
@@ -1,22 +0,0 @@
-Before:
- Save g:ale_c_parse_makefile
- let g:ale_c_parse_makefile = 0
-
- call ale#assert#SetUpLinterTest('c', 'gcc')
-
- let b:command_tail = ' -S -x c'
- \ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
- \ . ' -iquote ' . ale#Escape(getcwd())
- \ . ' -std=c11 -Wall -'
-
-After:
- call ale#assert#TearDownLinterTest()
-
- unlet! b:command_tail
-
-Execute(The executable should be configurable):
- AssertLinter 'gcc', [ale#Escape('gcc') . b:command_tail]
-
- let b:ale_c_gcc_executable = 'foobar'
-
- AssertLinter 'foobar', [ale#Escape('foobar') . b:command_tail]
diff --git a/test/command_callback/test_c_import_paths.vader b/test/command_callback/test_c_import_paths.vader
index e6102998..3c2bd79b 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,106 +19,67 @@ 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')
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir'))
+ \ . ' -iquote %s:h'
\ . ' -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')
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir'))
+ \ . ' -iquote %s:h'
\ . ' -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')
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
+ \ . ' -iquote %s: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('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')
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
- \ . ' -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'))
+ \ . ' -iquote %s:h'
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
\ . ' -'
@@ -131,99 +93,51 @@ 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')
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir'))
+ \ . ' -iquote %s:h'
\ . ' -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')
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir'))
+ \ . ' -iquote %s:h'
\ . ' -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')
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
+ \ . ' -iquote %s: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')
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
- \ . ' -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'))
+ \ . ' -iquote %s:h'
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
\ . ' -'
diff --git a/test/command_callback/test_cpp_cc_command_callbacks.vader b/test/command_callback/test_cpp_cc_command_callbacks.vader
new file mode 100644
index 00000000..dec3a07c
--- /dev/null
+++ b/test/command_callback/test_cpp_cc_command_callbacks.vader
@@ -0,0 +1,55 @@
+Before:
+ Save g:ale_c_parse_makefile
+ Save g:ale_history_enabled
+
+ let g:ale_c_parse_makefile = 0
+ let g:ale_history_enabled = 0
+
+ let g:get_cflags_return_value = ''
+ let g:executable_map = {}
+
+ runtime autoload/ale/c.vim
+ runtime autoload/ale/engine.vim
+
+ function! ale#engine#IsExecutable(buffer, executable) abort
+ return has_key(g:executable_map, a:executable)
+ endfunction
+
+ function! ale#c#GetCFlags(buffer, output) abort
+ return g:get_cflags_return_value
+ endfunction
+
+ call ale#assert#SetUpLinterTest('cpp', 'cc')
+
+ let b:command_tail = ' -S -x c++'
+ \ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
+ \ . ' -iquote %s:h'
+ \ . ' -std=c++14 -Wall -'
+
+After:
+ unlet! g:get_cflags_return_value
+ unlet! g:executable_map
+ unlet! b:command_tail
+
+ runtime autoload/ale/c.vim
+ runtime autoload/ale/engine.vim
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(clang++ should be used instead of gcc, if available):
+ let g:executable_map = {'clang++': 1}
+
+ AssertLinter 'clang++', [ale#Escape('clang++') . b:command_tail]
+
+Execute(The executable should be configurable):
+ AssertLinter 'gcc', [ale#Escape('gcc') . b:command_tail]
+
+ let b:ale_cpp_cc_executable = 'foobar'
+
+ AssertLinter 'foobar', [ale#Escape('foobar') . b:command_tail]
+
+Execute(The -std flag should be replaced by parsed C flags):
+ let b:command_tail = substitute(b:command_tail, 'c++14', 'c++11 ', '')
+ let g:get_cflags_return_value = '-std=c++11'
+
+ AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail
diff --git a/test/command_callback/test_cpp_clang_command_callbacks.vader b/test/command_callback/test_cpp_clang_command_callbacks.vader
deleted file mode 100644
index e96fd8e7..00000000
--- a/test/command_callback/test_cpp_clang_command_callbacks.vader
+++ /dev/null
@@ -1,19 +0,0 @@
-Before:
- Save g:ale_c_parse_makefile
- let g:ale_c_parse_makefile = 0
-
- call ale#assert#SetUpLinterTest('cpp', 'clang')
- let b:command_tail = ' -S -x c++ -fsyntax-only -iquote'
- \ . ' ' . ale#Escape(getcwd())
- \ . ' -std=c++14 -Wall -'
-
-After:
- unlet! b:command_tail
- call ale#assert#TearDownLinterTest()
-
-Execute(The executable should be configurable):
- AssertLinter 'clang++', ale#Escape('clang++') . b:command_tail
-
- let b:ale_cpp_clang_executable = 'foobar'
-
- AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
diff --git a/test/command_callback/test_cpp_gcc_command_callbacks.vader b/test/command_callback/test_cpp_gcc_command_callbacks.vader
deleted file mode 100644
index cfa4ecc0..00000000
--- a/test/command_callback/test_cpp_gcc_command_callbacks.vader
+++ /dev/null
@@ -1,20 +0,0 @@
-Before:
- Save g:ale_c_parse_makefile
- let g:ale_c_parse_makefile = 0
-
- call ale#assert#SetUpLinterTest('cpp', 'gcc')
- let b:command_tail = ' -S -x c++'
- \ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
- \ . ' -iquote ' . ale#Escape(getcwd())
- \ . ' -std=c++14 -Wall -'
-
-After:
- unlet! b:command_tail
- call ale#assert#TearDownLinterTest()
-
-Execute(The executable should be configurable):
- AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail
-
- let b:ale_cpp_gcc_executable = 'foobar'
-
- AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
diff --git a/test/command_callback/test_elixir_credo.vader b/test/command_callback/test_elixir_credo.vader
index 1a146db8..3eb88846 100644
--- a/test/command_callback/test_elixir_credo.vader
+++ b/test/command_callback/test_elixir_credo.vader
@@ -8,6 +8,18 @@ After:
call ale#assert#TearDownLinterTest()
+Execute(Builds credo command with normal project):
+ AssertLinter 'mix',
+ \ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/mix_project'))
+ \ . 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
+
+Execute(Builds credo command with umbrella project):
+ call ale#test#SetFilename('elixir_paths/umbrella_project/apps/mix_project/lib/app.ex')
+
+ AssertLinter 'mix',
+ \ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/umbrella_project'))
+ \ . 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
+
Execute(Builds credo command with --strict mode when set to 1):
let g:ale_elixir_credo_strict = 1
diff --git a/test/command_callback/test_embertemplatelint_command_callbacks.vader b/test/command_callback/test_embertemplatelint_command_callbacks.vader
new file mode 100644
index 00000000..97687d29
--- /dev/null
+++ b/test/command_callback/test_embertemplatelint_command_callbacks.vader
@@ -0,0 +1,17 @@
+Before:
+ call ale#assert#SetUpLinterTest('handlebars', 'embertemplatelint')
+
+ GivenCommandOutput ['1.6.0']
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(ember-template-lint executables runs the right command):
+ AssertLinter 'ember-template-lint',
+ \ ale#Escape('ember-template-lint') . ' --json --filename %s'
+
+Execute(old ember-template-lint executables runs the right command):
+ GivenCommandOutput []
+
+ AssertLinter 'ember-template-lint',
+ \ ale#Escape('ember-template-lint') . ' --json %t'
diff --git a/test/command_callback/test_flake8_command_callback.vader b/test/command_callback/test_flake8_command_callback.vader
index f082a63a..09f64ee3 100644
--- a/test/command_callback/test_flake8_command_callback.vader
+++ b/test/command_callback/test_flake8_command_callback.vader
@@ -34,13 +34,52 @@ Execute(The flake8 callbacks should return the correct default values):
\]
Execute(The option for disabling changing directories should work):
- let g:ale_python_flake8_change_directory = 0
+ let g:ale_python_flake8_change_directory = 'off'
AssertLinter 'flake8', [
\ ale#Escape('flake8') . ' --version',
\ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
\]
+ let g:ale_python_flake8_change_directory = 0
+
+ AssertLinter 'flake8', [
+ \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
+ \]
+
+ " Invalid options should be considered the same as turning the setting off.
+ let g:ale_python_flake8_change_directory = 'xxx'
+
+ AssertLinter 'flake8', [
+ \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
+ \]
+
+Execute(The option for changing directory to project root should work):
+ silent execute 'file ' . fnameescape(g:dir . '/python_paths/namespace_package_tox/namespace/foo/bar.py')
+
+ AssertLinter 'flake8', [
+ \ ale#Escape('flake8') . ' --version',
+ \ ale#path#CdString(ale#python#FindProjectRootIni(bufnr('')))
+ \ . ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
+ \]
+
+Execute(The option for changing directory to file dir should work):
+ let g:ale_python_flake8_change_directory = 'file'
+ silent execute 'file ' . fnameescape(g:dir . '/python_paths/namespace_package_tox/namespace/foo/bar.py')
+
+ AssertLinter 'flake8', [
+ \ ale#Escape('flake8') . ' --version',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
+ \]
+
+ let g:ale_python_flake8_change_directory = 1
+
+ AssertLinter 'flake8', [
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
+ \]
+
Execute(The flake8 command callback should let you set options):
let g:ale_python_flake8_options = '--some-option'
@@ -163,5 +202,5 @@ Execute(Pipenv is detected when python_flake8_auto_pipenv is set):
call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py')
AssertLinter 'pipenv',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(ale#python#FindProjectRootIni(bufnr('')))
\ . ale#Escape('pipenv') . ' run flake8 --format=default --stdin-display-name %s -'
diff --git a/test/command_callback/test_gobuild_command_callback.vader b/test/command_callback/test_gobuild_command_callback.vader
index fdf23866..063f3f2f 100644
--- a/test/command_callback/test_gobuild_command_callback.vader
+++ b/test/command_callback/test_gobuild_command_callback.vader
@@ -11,14 +11,14 @@ After:
Execute(The default commands should be correct):
AssertLinter 'go',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . 'go test -c -o /dev/null ./'
Execute(Go environment variables should be supported):
let b:ale_go_go111module = 'on'
AssertLinter 'go',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Env('GO111MODULE', 'on')
\ . 'go test -c -o /dev/null ./'
@@ -28,7 +28,7 @@ Execute(Extra options should be supported):
let g:ale_go_gobuild_options = '--foo-bar'
AssertLinter 'go',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . 'go test --foo-bar -c -o /dev/null ./'
let g:ale_go_gobuild_options = ''
@@ -37,5 +37,5 @@ Execute(The executable should be configurable):
let g:ale_go_go_executable = 'foobar'
AssertLinter 'foobar',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . 'foobar test -c -o /dev/null ./'
diff --git a/test/command_callback/test_gofmt_command_callback.vader b/test/command_callback/test_gofmt_command_callback.vader
index 4da1f6c8..88b2e6b0 100644
--- a/test/command_callback/test_gofmt_command_callback.vader
+++ b/test/command_callback/test_gofmt_command_callback.vader
@@ -1,5 +1,8 @@
Before:
Save g:ale_go_go111module
+ Save b:ale_go_go111module
+
+ let b:ale_go_go111module = ''
call ale#assert#SetUpLinterTest('go', 'gofmt')
call ale#test#SetFilename('../go_files/testfile2.go')
diff --git a/test/command_callback/test_golangci_lint_command_callback.vader b/test/command_callback/test_golangci_lint_command_callback.vader
index 7f1e2ac4..37fb1f7d 100644
--- a/test/command_callback/test_golangci_lint_command_callback.vader
+++ b/test/command_callback/test_golangci_lint_command_callback.vader
@@ -13,7 +13,7 @@ After:
Execute(The golangci-lint defaults should be correct):
AssertLinter 'golangci-lint',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('golangci-lint')
\ . ' run ' . ale#Escape(expand('%' . ':t'))
\ . ' --enable-all'
@@ -22,7 +22,7 @@ Execute(The golangci-lint callback should use a configured executable):
let b:ale_go_golangci_lint_executable = 'something else'
AssertLinter 'something else',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('something else')
\ . ' run ' . ale#Escape(expand('%' . ':t'))
\ . ' --enable-all'
@@ -31,7 +31,7 @@ Execute(The golangci-lint callback should use configured options):
let b:ale_go_golangci_lint_options = '--foobar'
AssertLinter 'golangci-lint',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('golangci-lint')
\ . ' run ' . ale#Escape(expand('%' . ':t'))
\ . ' --foobar'
@@ -40,7 +40,7 @@ Execute(The golangci-lint callback should support environment variables):
let b:ale_go_go111module = 'on'
AssertLinter 'golangci-lint',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Env('GO111MODULE', 'on')
\ . ale#Escape('golangci-lint')
\ . ' run ' . ale#Escape(expand('%' . ':t'))
@@ -50,5 +50,5 @@ Execute(The golangci-lint `lint_package` option should use the correct command):
let b:ale_go_golangci_lint_package = 1
AssertLinter 'golangci-lint',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('golangci-lint') . ' run --enable-all'
diff --git a/test/command_callback/test_gometalinter_command_callback.vader b/test/command_callback/test_gometalinter_command_callback.vader
index d922efc6..567997d8 100644
--- a/test/command_callback/test_gometalinter_command_callback.vader
+++ b/test/command_callback/test_gometalinter_command_callback.vader
@@ -13,7 +13,7 @@ After:
Execute(The gometalinter defaults should be correct):
AssertLinter 'gometalinter',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('gometalinter')
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
\ . ' .'
@@ -22,7 +22,7 @@ Execute(The gometalinter callback should use a configured executable):
let b:ale_go_gometalinter_executable = 'something else'
AssertLinter 'something else',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('something else')
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
\ . ' .'
@@ -31,7 +31,7 @@ Execute(The gometalinter callback should use configured options):
let b:ale_go_gometalinter_options = '--foobar'
AssertLinter 'gometalinter',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('gometalinter')
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
\ . ' --foobar' . ' .'
@@ -40,7 +40,7 @@ Execute(The gometalinter should use configured environment variables):
let b:ale_go_go111module = 'off'
AssertLinter 'gometalinter',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Env('GO111MODULE', 'off')
\ . ale#Escape('gometalinter')
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
@@ -50,5 +50,5 @@ Execute(The gometalinter `lint_package` option should use the correct command):
let b:ale_go_gometalinter_lint_package = 1
AssertLinter 'gometalinter',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('gometalinter') . ' .'
diff --git a/test/command_callback/test_gosimple_command_callback.vader b/test/command_callback/test_gosimple_command_callback.vader
index ee89eed8..b006f783 100644
--- a/test/command_callback/test_gosimple_command_callback.vader
+++ b/test/command_callback/test_gosimple_command_callback.vader
@@ -11,11 +11,12 @@ After:
Execute(The default gosimple command should be correct):
AssertLinter 'gosimple',
- \ ale#path#CdString(expand('%:p:h')) . ' gosimple .'
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ' gosimple .'
Execute(The gosimple command should support Go environment variables):
let b:ale_go_go111module = 'on'
AssertLinter 'gosimple',
- \ ale#path#CdString(expand('%:p:h')) . ' '
- \ . ale#Env('GO111MODULE', 'on') . 'gosimple .'
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ' ' . ale#Env('GO111MODULE', 'on') . 'gosimple .'
diff --git a/test/command_callback/test_gotype_command_callback.vader b/test/command_callback/test_gotype_command_callback.vader
index 1334fcff..204197d9 100644
--- a/test/command_callback/test_gotype_command_callback.vader
+++ b/test/command_callback/test_gotype_command_callback.vader
@@ -11,7 +11,8 @@ After:
Execute(The default gotype command should be correct):
AssertLinter 'gotype',
- \ ale#path#CdString(expand('%:p:h')) . ' gotype -e .'
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ' gotype -e .'
Execute(The gotype callback should ignore test files):
call ale#test#SetFilename('bla_test.go')
@@ -22,6 +23,6 @@ Execute(The gotype callback should support Go environment variables):
let b:ale_go_go111module = 'on'
AssertLinter 'gotype',
- \ ale#path#CdString(expand('%:p:h')) . ' '
- \ . ale#Env('GO111MODULE', 'on')
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ' ' . ale#Env('GO111MODULE', 'on')
\ . 'gotype -e .'
diff --git a/test/command_callback/test_govet_command_callback.vader b/test/command_callback/test_govet_command_callback.vader
index 59022180..0e1ea092 100644
--- a/test/command_callback/test_govet_command_callback.vader
+++ b/test/command_callback/test_govet_command_callback.vader
@@ -13,22 +13,22 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The default command should be correct):
- AssertLinter 'go', ale#path#CdString(expand('%:p:h')) . ' go vet .'
+ AssertLinter 'go', ale#path#BufferCdString(bufnr('')) . ' go vet .'
Execute(Extra options should be supported):
let g:ale_go_govet_options = '--foo-bar'
- AssertLinter 'go', ale#path#CdString(expand('%:p:h')) . ' go vet --foo-bar .'
+ AssertLinter 'go', ale#path#BufferCdString(bufnr('')) . ' go vet --foo-bar .'
Execute(The executable should be configurable):
let g:ale_go_go_executable = 'foobar'
- AssertLinter 'foobar', ale#path#CdString(expand('%:p:h')) . ' foobar vet .'
+ AssertLinter 'foobar', ale#path#BufferCdString(bufnr('')) . ' foobar vet .'
Execute(Go environment variables should be supported):
let b:ale_go_go111module = 'on'
AssertLinter 'go',
- \ ale#path#CdString(expand('%:p:h')) . ' '
+ \ ale#path#BufferCdString(bufnr('')) . ' '
\ . ale#Env('GO111MODULE', 'on')
\ . 'go vet .'
diff --git a/test/command_callback/test_graphql_gqlint_command_callbacks.vader b/test/command_callback/test_graphql_gqlint_command_callbacks.vader
index 0f4e9770..e8ed0e5d 100644
--- a/test/command_callback/test_graphql_gqlint_command_callbacks.vader
+++ b/test/command_callback/test_graphql_gqlint_command_callbacks.vader
@@ -6,6 +6,6 @@ After:
Execute(The linter should run from the directory of the file in the buffer):
AssertLinter 'gqlint',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . 'gqlint --reporter=simple'
\ . ' %t'
diff --git a/test/command_callback/test_javac_command_callback.vader b/test/command_callback/test_javac_command_callback.vader
index d2eebf7a..ac898e5f 100644
--- a/test/command_callback/test_javac_command_callback.vader
+++ b/test/command_callback/test_javac_command_callback.vader
@@ -3,7 +3,7 @@ Before:
call ale#test#SetFilename('dummy.java')
let g:cp_sep = has('unix') ? ':' : ';'
- let g:prefix = ale#path#CdString(expand('%:p:h'))
+ let g:prefix = ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('javac') . ' -Xlint'
function! GetCommand(previous_output) abort
@@ -51,7 +51,7 @@ Execute(The executable should be configurable):
let g:ale_java_javac_executable = 'foobar'
AssertLinter 'foobar',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('foobar') . ' -Xlint'
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
@@ -197,7 +197,8 @@ Execute(The javac callback should combine discovered sourcepath and manual ones)
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
AssertEqual
- \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('javac') . ' -Xlint'
\ . ' -sourcepath ' . ale#Escape(join([
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
\ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/'),
@@ -210,7 +211,8 @@ Execute(The javac callback should combine discovered sourcepath and manual ones)
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
AssertEqual
- \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('javac') . ' -Xlint'
\ . ' -sourcepath ' . ale#Escape(join([
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
\ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/'),
@@ -223,7 +225,8 @@ Execute(The javac callback should combine discovered sourcepath and manual ones)
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
AssertEqual
- \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('javac') . ' -Xlint'
\ . ' -sourcepath ' . ale#Escape(join([
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
\ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/')
@@ -238,7 +241,8 @@ Execute(The javac callback should combine discovered sourcepath and manual ones)
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
AssertEqual
- \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('javac') . ' -Xlint'
\ . ' -sourcepath ' . ale#Escape(join([
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
\ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/'),
@@ -253,7 +257,8 @@ Execute(The javac callback should detect source directories):
call ale#engine#InitBufferInfo(bufnr(''))
AssertLinter 'javac',
- \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('javac') . ' -Xlint'
\ . ' -sourcepath ' . ale#Escape(
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/')
\ )
@@ -272,7 +277,8 @@ Execute(The javac callback should combine detected source directories and classp
\], {})
AssertEqual
- \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('javac') . ' -Xlint'
\ . ' -cp ' . ale#Escape(join(['/foo/bar.jar', '/xyz/abc.jar'], g:cp_sep))
\ . ' -sourcepath ' . ale#Escape(
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/')
@@ -294,7 +300,8 @@ Execute(The javac callback should include src/test/java for test paths):
call ale#engine#InitBufferInfo(bufnr(''))
AssertLinter 'javac',
- \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('javac') . ' -Xlint'
\ . ' -sourcepath ' . ale#Escape(join([
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
\ ale#path#Simplify(g:dir . '/java_paths/src/test/java/'),
@@ -307,7 +314,8 @@ Execute(The javac callback should include src/main/jaxb when available):
call ale#engine#InitBufferInfo(bufnr(''))
AssertLinter 'javac',
- \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('javac') . ' -Xlint'
\ . ' -sourcepath ' . ale#Escape(join([
\ ale#path#Simplify(g:dir . '/java_paths_with_jaxb/src/main/java/'),
\ ale#path#Simplify(g:dir . '/java_paths_with_jaxb/src/main/jaxb/'),
@@ -320,7 +328,8 @@ Execute(The javac callback should add -sourcepath even if src/java/main doesn't
call ale#engine#InitBufferInfo(bufnr(''))
AssertLinter 'javac',
- \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('javac') . ' -Xlint'
\ . ' -sourcepath ' . ale#Escape(join([
\ ale#path#Simplify(g:dir . '/java_paths_no_main/src/test/java/'),
\ ], g:cp_sep))
diff --git a/test/command_callback/test_lintr_command_callback.vader b/test/command_callback/test_lintr_command_callback.vader
index 187d3875..ac4b419b 100644
--- a/test/command_callback/test_lintr_command_callback.vader
+++ b/test/command_callback/test_lintr_command_callback.vader
@@ -6,7 +6,7 @@ After:
Execute(The default lintr command should be correct):
AssertLinter 'Rscript',
- \ ale#path#CdString(getcwd())
+ \ ale#path#BufferCdString(bufnr(''))
\ . 'Rscript --vanilla -e '
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
@@ -17,7 +17,7 @@ Execute(The lintr options should be configurable):
let b:ale_r_lintr_options = 'with_defaults(object_usage_linter = NULL)'
AssertLinter 'Rscript',
- \ ale#path#CdString(getcwd())
+ \ ale#path#BufferCdString(bufnr(''))
\ . 'Rscript --vanilla -e '
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
@@ -28,7 +28,7 @@ Execute(If the lint_package flag is set, lintr::lint_package should be called):
let b:ale_r_lintr_lint_package = 1
AssertLinter 'Rscript',
- \ ale#path#CdString(getcwd())
+ \ ale#path#BufferCdString(bufnr(''))
\ . 'Rscript --vanilla -e '
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
\ . 'lint_package(cache = FALSE, '
diff --git a/test/command_callback/test_markdown_markdownlint_command_callback.vader b/test/command_callback/test_markdown_markdownlint_command_callback.vader
new file mode 100644
index 00000000..12766cfd
--- /dev/null
+++ b/test/command_callback/test_markdown_markdownlint_command_callback.vader
@@ -0,0 +1,13 @@
+Before:
+ call ale#assert#SetUpLinterTest('markdown', 'markdownlint')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default command should be correct):
+ AssertLinter 'markdownlint', ale#Escape('markdownlint') . ' %s'
+
+Execute(The options should be configurable):
+ let g:ale_markdown_markdownlint_options = '--config ~/custom/.markdownlintrc'
+
+ AssertLinter 'markdownlint', ale#Escape('markdownlint') . ' --config ~/custom/.markdownlintrc %s'
diff --git a/test/command_callback/test_mypy_command_callback.vader b/test/command_callback/test_mypy_command_callback.vader
index afa9f9af..b9b6ae70 100644
--- a/test/command_callback/test_mypy_command_callback.vader
+++ b/test/command_callback/test_mypy_command_callback.vader
@@ -75,14 +75,14 @@ Execute(Setting executable to 'pipenv' appends 'run mypy'):
let g:ale_python_mypy_executable = 'path/to/pipenv'
AssertLinter 'path/to/pipenv',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('path/to/pipenv') . ' run mypy'
\ . ' --show-column-numbers --shadow-file %s %t %s'
Execute(Pipenv is detected when python_mypy_auto_pipenv is set):
let g:ale_python_mypy_auto_pipenv = 1
- call ale#test#SetFilename('/testplugin/test/python_fixtures/pipenv/whatever.py')
+ call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py')
AssertLinter 'pipenv',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('pipenv') . ' run mypy --show-column-numbers --shadow-file %s %t %s'
diff --git a/test/command_callback/test_nasm_nasm_command_callbacks.vader b/test/command_callback/test_nasm_nasm_command_callbacks.vader
index 8e077306..2bfe2b0d 100644
--- a/test/command_callback/test_nasm_nasm_command_callbacks.vader
+++ b/test/command_callback/test_nasm_nasm_command_callbacks.vader
@@ -2,9 +2,9 @@ Before:
call ale#assert#SetUpLinterTest('nasm', 'nasm')
let b:command_tail =
- \ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
+ \ ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
let b:command_tail_opt =
- \ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w+orphan-labels %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
+ \ ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') . ' -w+orphan-labels %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
After:
unlet! b:command_tail
@@ -23,7 +23,8 @@ Execute(The options should be configurable):
let b:ale_nasm_nasm_options = '-w-macro-params'
AssertLinter 'nasm', ale#Escape('nasm')
- \ . ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w-macro-params %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
+ \ . ' -X gnu -I %s:h' . (has('win32') ? '\' : '/')
+ \ . ' -w-macro-params %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
Execute(The options should be used in command):
let b:ale_nasm_nasm_options = '-w+orphan-labels'
diff --git a/test/command_callback/test_psalm_command_callbacks.vader b/test/command_callback/test_psalm_command_callbacks.vader
index 70b5af95..d32780e6 100644
--- a/test/command_callback/test_psalm_command_callbacks.vader
+++ b/test/command_callback/test_psalm_command_callbacks.vader
@@ -2,6 +2,9 @@ Before:
call ale#assert#SetUpLinterTest('php', 'psalm')
After:
+ unlet! g:i
+ unlet! g:matched
+
if isdirectory(g:dir . '/.git')
call delete(g:dir . '/.git', 'd')
endif
@@ -22,19 +25,36 @@ Execute(Vendor executables should be detected):
\ . '/psalm-project/vendor/bin/psalm'
\ )) . ' --language-server'
+ let g:ale_php_psalm_use_global = 1
+
+ AssertLinter 'psalm',
+ \ ale#Escape('psalm') . ' --language-server'
+
Execute(User provided options should be used):
- let g:ale_psalm_langserver_options = '--my-user-provided-option my-value'
+ let g:ale_php_psalm_options = '--my-user-provided-option my-value'
AssertLinter 'psalm',
\ ale#Escape('psalm')
\ . ' --language-server --my-user-provided-option my-value'
-
Execute(The project path should be correct for .git directories):
call ale#test#SetFilename('psalm-project/test.php')
+ let g:matched = 0
- if !isdirectory(g:dir . '/.git')
- call mkdir(g:dir . '/.git')
- endif
+ for g:i in range(4)
+ if !isdirectory(g:dir . '/.git')
+ call mkdir(g:dir . '/.git')
+ endif
+
+ try
+ AssertLSPProject g:dir
+ catch /.+/
+ endtry
- AssertLSPProject g:dir
+ let g:matched = 1
+ break
+ endfor
+
+ if !g:matched
+ AssertLSPProject g:dir
+ endif
diff --git a/test/command_callback/test_pydocstyle_command_callback.vader b/test/command_callback/test_pydocstyle_command_callback.vader
index 7e0df9ca..511443a6 100644
--- a/test/command_callback/test_pydocstyle_command_callback.vader
+++ b/test/command_callback/test_pydocstyle_command_callback.vader
@@ -1,5 +1,6 @@
Before:
call ale#assert#SetUpLinterTest('python', 'pydocstyle')
+ call ale#test#SetFilename('test.py')
After:
call ale#assert#TearDownLinterTest()
@@ -7,33 +8,33 @@ After:
Execute(The pydocstyle command callback should return default string):
AssertLinter 'pydocstyle',
\ ale#path#BufferCdString(bufnr(''))
- \ . ale#Escape('pydocstyle') . ' ' . ale#Escape('dummy.txt')
+ \ . ale#Escape('pydocstyle') . ' %s:t'
Execute(The pydocstyle command callback should allow options):
let g:ale_python_pydocstyle_options = '--verbose'
AssertLinter 'pydocstyle',
\ ale#path#BufferCdString(bufnr(''))
- \ . ale#Escape('pydocstyle') . ' --verbose ' . ale#Escape('dummy.txt')
+ \ . ale#Escape('pydocstyle') . ' --verbose %s:t'
Execute(The pydocstyle executable should be configurable):
let g:ale_python_pydocstyle_executable = '~/.local/bin/pydocstyle'
AssertLinter '~/.local/bin/pydocstyle',
\ ale#path#BufferCdString(bufnr(''))
- \ . ale#Escape('~/.local/bin/pydocstyle') . ' ' . ale#Escape('dummy.txt')
+ \ . ale#Escape('~/.local/bin/pydocstyle') . ' %s:t'
Execute(Setting executable to 'pipenv' appends 'run pydocstyle'):
let g:ale_python_pydocstyle_executable = 'path/to/pipenv'
AssertLinter 'path/to/pipenv',
\ ale#path#BufferCdString(bufnr(''))
- \ . ale#Escape('path/to/pipenv') . ' run pydocstyle ' . ale#Escape('dummy.txt')
+ \ . ale#Escape('path/to/pipenv') . ' run pydocstyle %s:t'
Execute(Pipenv is detected when python_pydocstyle_auto_pipenv is set):
let g:ale_python_pydocstyle_auto_pipenv = 1
- call ale#test#SetFilename('/testplugin/test/python_fixtures/pipenv/whatever.py')
+ call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py')
AssertLinter 'pipenv',
\ ale#path#BufferCdString(bufnr(''))
- \ . ale#Escape('pipenv') . ' run pydocstyle ' . ale#Escape('whatever.py')
+ \ . ale#Escape('pipenv') . ' run pydocstyle %s:t'
diff --git a/test/command_callback/test_pylama_command_callback.vader b/test/command_callback/test_pylama_command_callback.vader
index 417cb5c9..0aea9a93 100644
--- a/test/command_callback/test_pylama_command_callback.vader
+++ b/test/command_callback/test_pylama_command_callback.vader
@@ -14,7 +14,7 @@ After:
Execute(The pylama command callback should return a default):
AssertLinter 'pylama',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('pylama') . b:command_tail
Execute(The option for disabling changing directories should work):
@@ -26,14 +26,14 @@ Execute(The pylama executable should be configurable, and escaped properly):
let g:ale_python_pylama_executable = 'executable with spaces'
AssertLinter 'executable with spaces',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('executable with spaces') . b:command_tail
Execute(The pylama command callback should let you set options):
let g:ale_python_pylama_options = '--some-option'
AssertLinter 'pylama',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('pylama') . ' --some-option' . b:command_tail
Execute(The pylama command callback should switch directories to the detected project root):
@@ -73,13 +73,13 @@ Execute(Setting executable to 'pipenv' appends 'run pylama'):
let g:ale_python_pylama_executable = 'path/to/pipenv'
AssertLinter 'path/to/pipenv',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('path/to/pipenv') . ' run pylama' . b:command_tail
Execute(Pipenv is detected when python_pylama_auto_pipenv is set):
let g:ale_python_pylama_auto_pipenv = 1
- call ale#test#SetFilename('/testplugin/test/python_fixtures/pipenv/whatever.py')
+ call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py')
AssertLinter 'pipenv',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('pipenv') . ' run pylama' . b:command_tail
diff --git a/test/command_callback/test_pylint_command_callback.vader b/test/command_callback/test_pylint_command_callback.vader
index c41c8398..755dd292 100644
--- a/test/command_callback/test_pylint_command_callback.vader
+++ b/test/command_callback/test_pylint_command_callback.vader
@@ -1,4 +1,8 @@
Before:
+ Save g:ale_python_auto_pipenv
+
+ let g:ale_python_auto_pipenv = 0
+
call ale#assert#SetUpLinterTest('python', 'pylint')
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
@@ -13,7 +17,7 @@ After:
Execute(The pylint callbacks should return the correct default values):
AssertLinter 'pylint',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('pylint') . ' ' . b:command_tail
Execute(The option for disabling changing directories should work):
@@ -25,14 +29,14 @@ Execute(The pylint executable should be configurable, and escaped properly):
let g:ale_python_pylint_executable = 'executable with spaces'
AssertLinter 'executable with spaces',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('executable with spaces') . ' ' . b:command_tail
Execute(The pylint command callback should let you set options):
let g:ale_python_pylint_options = '--some-option'
AssertLinter 'pylint',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('pylint') . ' --some-option' . b:command_tail
Execute(The pylint callbacks shouldn't detect virtualenv directories where they don't exist):
@@ -65,15 +69,15 @@ Execute(Setting executable to 'pipenv' appends 'run pylint'):
let g:ale_python_pylint_executable = 'path/to/pipenv'
AssertLinter 'path/to/pipenv',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('path/to/pipenv') . ' run pylint'
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
Execute(Pipenv is detected when python_pylint_auto_pipenv is set):
let g:ale_python_pylint_auto_pipenv = 1
- call ale#test#SetFilename('/testplugin/test/python_fixtures/pipenv/whatever.py')
+ call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py')
AssertLinter 'pipenv',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('pipenv') . ' run pylint'
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
diff --git a/test/command_callback/test_pyrex_cython_command_callback.vader b/test/command_callback/test_pyrex_cython_command_callback.vader
index b9020f11..af86366a 100644
--- a/test/command_callback/test_pyrex_cython_command_callback.vader
+++ b/test/command_callback/test_pyrex_cython_command_callback.vader
@@ -6,8 +6,8 @@ After:
Execute(The default cython command should be correct):
AssertLinter 'cython', ale#Escape('cython')
- \ . ' --working ' . ale#Escape(g:dir)
- \ . ' --include-dir ' . ale#Escape(g:dir)
+ \ . ' --working %s:h'
+ \ . ' --include-dir %s:h'
\ . ' --warning-extra'
\ . ' --output-file ' . g:ale#util#nul_file . ' %t'
@@ -15,8 +15,8 @@ Execute(The cython executable should be configurable):
let b:ale_pyrex_cython_executable = 'cython_foobar'
AssertLinter 'cython_foobar', ale#Escape('cython_foobar')
- \ . ' --working ' . ale#Escape(g:dir)
- \ . ' --include-dir ' . ale#Escape(g:dir)
+ \ . ' --working %s:h'
+ \ . ' --include-dir %s:h'
\ . ' --warning-extra'
\ . ' --output-file ' . g:ale#util#nul_file . ' %t'
@@ -24,7 +24,7 @@ Execute(Additional cython options should be configurable):
let b:ale_pyrex_cython_options = '--foobar'
AssertLinter 'cython', ale#Escape('cython')
- \ . ' --working ' . ale#Escape(g:dir)
- \ . ' --include-dir ' . ale#Escape(g:dir)
+ \ . ' --working %s:h'
+ \ . ' --include-dir %s:h'
\ . ' --foobar'
\ . ' --output-file ' . g:ale#util#nul_file . ' %t'
diff --git a/test/command_callback/test_rubocop_command_callback.vader b/test/command_callback/test_rubocop_command_callback.vader
index 7f42a8c0..e7cc32e8 100644
--- a/test/command_callback/test_rubocop_command_callback.vader
+++ b/test/command_callback/test_rubocop_command_callback.vader
@@ -10,20 +10,17 @@ After:
Execute(Executable should default to rubocop):
AssertLinter 'rubocop', ale#Escape('rubocop')
- \ . ' --format json --force-exclusion --stdin '
- \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
+ \ . ' --format json --force-exclusion --stdin %s'
Execute(Should be able to set a custom executable):
let g:ale_ruby_rubocop_executable = 'bin/rubocop'
AssertLinter 'bin/rubocop' , ale#Escape('bin/rubocop')
- \ . ' --format json --force-exclusion --stdin '
- \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
+ \ . ' --format json --force-exclusion --stdin %s'
Execute(Setting bundle appends 'exec rubocop'):
let g:ale_ruby_rubocop_executable = 'path to/bundle'
AssertLinter 'path to/bundle', ale#Escape('path to/bundle')
\ . ' exec rubocop'
- \ . ' --format json --force-exclusion --stdin '
- \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
+ \ . ' --format json --force-exclusion --stdin %s'
diff --git a/test/command_callback/test_ruumba_command_callback.vader b/test/command_callback/test_ruumba_command_callback.vader
index 244b264a..9fa48903 100644
--- a/test/command_callback/test_ruumba_command_callback.vader
+++ b/test/command_callback/test_ruumba_command_callback.vader
@@ -10,20 +10,17 @@ After:
Execute(Executable should default to ruumba):
AssertLinter 'ruumba', ale#Escape('ruumba')
- \ . ' --format json --force-exclusion --stdin '
- \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.html.erb'))
+ \ . ' --format json --force-exclusion --stdin %s'
Execute(Should be able to set a custom executable):
let g:ale_eruby_ruumba_executable = 'bin/ruumba'
AssertLinter 'bin/ruumba' , ale#Escape('bin/ruumba')
- \ . ' --format json --force-exclusion --stdin '
- \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.html.erb'))
+ \ . ' --format json --force-exclusion --stdin %s'
Execute(Setting bundle appends 'exec ruumba'):
let g:ale_eruby_ruumba_executable = 'path to/bundle'
AssertLinter 'path to/bundle', ale#Escape('path to/bundle')
\ . ' exec ruumba'
- \ . ' --format json --force-exclusion --stdin '
- \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.html.erb'))
+ \ . ' --format json --force-exclusion --stdin %s'
diff --git a/test/command_callback/test_shellcheck_command_callback.vader b/test/command_callback/test_shellcheck_command_callback.vader
index 1d5b056b..9fb5303a 100644
--- a/test/command_callback/test_shellcheck_command_callback.vader
+++ b/test/command_callback/test_shellcheck_command_callback.vader
@@ -2,7 +2,7 @@ Before:
call ale#assert#SetUpLinterTest('sh', 'shellcheck')
call ale#test#SetFilename('test.sh')
- let b:prefix = ale#path#CdString(ale#path#Simplify(g:dir))
+ let b:prefix = ale#path#BufferCdString(bufnr(''))
let b:suffix = ' -f gcc -'
After:
diff --git a/test/command_callback/test_sqllint_command_callback.vader b/test/command_callback/test_sqllint_command_callback.vader
new file mode 100644
index 00000000..eea9b4e0
--- /dev/null
+++ b/test/command_callback/test_sqllint_command_callback.vader
@@ -0,0 +1,12 @@
+Before:
+ " Load the linter and set up a series of commands, reset linter variables,
+ " clear caches, etc.
+ "
+ " Vader's 'Save' command will be called here for linter variables.
+ call ale#assert#SetUpLinterTest('sql', 'sqllint')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default command should be correct):
+ AssertLinter 'sql-lint', ['sql-lint']
diff --git a/test/command_callback/test_standardrb_command_callback.vader b/test/command_callback/test_standardrb_command_callback.vader
index 7bc1c976..108dd870 100644
--- a/test/command_callback/test_standardrb_command_callback.vader
+++ b/test/command_callback/test_standardrb_command_callback.vader
@@ -10,20 +10,17 @@ After:
Execute(Executable should default to standardrb):
AssertLinter 'standardrb', ale#Escape('standardrb')
- \ . ' --format json --force-exclusion --stdin '
- \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
+ \ . ' --format json --force-exclusion --stdin %s'
Execute(Should be able to set a custom executable):
let g:ale_ruby_standardrb_executable = 'bin/standardrb'
AssertLinter 'bin/standardrb' , ale#Escape('bin/standardrb')
- \ . ' --format json --force-exclusion --stdin '
- \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
+ \ . ' --format json --force-exclusion --stdin %s'
Execute(Setting bundle appends 'exec standardrb'):
let g:ale_ruby_standardrb_executable = 'path to/bundle'
AssertLinter 'path to/bundle', ale#Escape('path to/bundle')
\ . ' exec standardrb'
- \ . ' --format json --force-exclusion --stdin '
- \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
+ \ . ' --format json --force-exclusion --stdin %s'
diff --git a/test/command_callback/test_staticcheck_command_callback.vader b/test/command_callback/test_staticcheck_command_callback.vader
index ae0d3584..871a5510 100644
--- a/test/command_callback/test_staticcheck_command_callback.vader
+++ b/test/command_callback/test_staticcheck_command_callback.vader
@@ -11,7 +11,7 @@ After:
Execute(The staticcheck callback should return the right defaults):
AssertLinter 'staticcheck',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . 'staticcheck '
\ . ale#Escape(expand('%' . ':t'))
@@ -19,7 +19,7 @@ Execute(The staticcheck callback should use configured options):
let b:ale_go_staticcheck_options = '-test'
AssertLinter 'staticcheck',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . 'staticcheck '
\ . '-test ' . ale#Escape(expand('%' . ':t'))
@@ -27,13 +27,14 @@ Execute(The staticcheck `lint_package` option should use the correct command):
let b:ale_go_staticcheck_lint_package = 1
AssertLinter 'staticcheck',
- \ ale#path#CdString(expand('%:p:h')) . 'staticcheck .',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . 'staticcheck .',
Execute(The staticcheck callback should use the `GO111MODULE` option if set):
let b:ale_go_go111module = 'off'
AssertLinter 'staticcheck',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Env('GO111MODULE', 'off')
\ . 'staticcheck '
\ . ale#Escape(expand('%' . ':t'))
@@ -42,6 +43,6 @@ Execute(The staticcheck callback should use the `GO111MODULE` option if set):
let b:ale_go_staticcheck_lint_package = 1
AssertLinter 'staticcheck',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Env('GO111MODULE', 'off')
\ . 'staticcheck .'
diff --git a/test/command_callback/test_swift_swiftformat_command_callbacks.vader b/test/command_callback/test_swift_swiftformat_command_callbacks.vader
new file mode 100644
index 00000000..7be20bf7
--- /dev/null
+++ b/test/command_callback/test_swift_swiftformat_command_callbacks.vader
@@ -0,0 +1,25 @@
+Before:
+ call ale#assert#SetUpLinterTest('swift', 'swiftformat')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(Should use default command when not in a swift package):
+ call ale#test#SetFilename('../swift-test-files/non-swift-package-project/src/folder/dummy.swift')
+
+ AssertLinter 'swift-format',
+ \ ale#Escape('swift-format') . ' --mode lint %t'
+
+Execute(Should use swift run when in a swift package):
+ call ale#test#SetFilename('../swift-test-files/swift-package-project/src/folder/dummy.swift')
+
+ AssertLinter 'swift',
+ \ ale#Escape('swift') . ' run swift-format --mode lint %t'
+
+Execute(Should let users configure a global executable and override local paths):
+ call ale#test#SetFilename('../swift-test-files/swift-package-project/src/folder/dummy.swift')
+
+ let g:ale_swift_swiftformat_executable = '/path/to/custom/swift-format'
+
+ AssertLinter '/path/to/custom/swift-format',
+ \ ale#Escape('/path/to/custom/swift-format') . ' --mode lint %t'
diff --git a/test/command_callback/test_tslint_command_callback.vader b/test/command_callback/test_tslint_command_callback.vader
index 229ccc96..cc5d2666 100644
--- a/test/command_callback/test_tslint_command_callback.vader
+++ b/test/command_callback/test_tslint_command_callback.vader
@@ -7,14 +7,14 @@ After:
Execute(The default tslint command should be correct):
AssertLinter 'tslint',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('tslint') . ' --format json %t'
Execute(The rules directory option should be included if set):
let b:ale_typescript_tslint_rules_dir = '/foo/bar'
AssertLinter 'tslint',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('tslint') . ' --format json'
\ . ' -r ' . ale#Escape('/foo/bar')
\ . ' %t'
@@ -23,5 +23,5 @@ Execute(The executable should be configurable and escaped):
let b:ale_typescript_tslint_executable = 'foo bar'
AssertLinter 'foo bar',
- \ ale#path#CdString(expand('%:p:h'))
+ \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('foo bar') . ' --format json %t'
diff --git a/test/command_callback/test_vint_command_callback.vader b/test/command_callback/test_vint_command_callback.vader
index e0051f26..4ce277e8 100644
--- a/test/command_callback/test_vint_command_callback.vader
+++ b/test/command_callback/test_vint_command_callback.vader
@@ -1,7 +1,7 @@
Before:
call ale#assert#SetUpLinterTest('vim', 'vint')
let b:command_tail = (has('nvim') ? ' --enable-neovim' : '')
- \ . ' -f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})" %t'
+ \ . ' -f "{file_path}:{line_number}:{column_number}: {severity}: {policy_name} - {description} (see {reference})" %t'
After:
unlet! b:bin_dir
diff --git a/test/command_callback/test_vulture_command_callback.vader b/test/command_callback/test_vulture_command_callback.vader
index d6c866b9..bacf8f12 100644
--- a/test/command_callback/test_vulture_command_callback.vader
+++ b/test/command_callback/test_vulture_command_callback.vader
@@ -12,7 +12,7 @@ After:
Execute(The vulture command callback should lint file directory by default):
AssertLinter 'vulture',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('vulture') . ' .'
Execute(The vulture command callback should lint project root, when present):
@@ -31,14 +31,14 @@ Execute(The vulture executable should be configurable, and escaped properly):
let g:ale_python_vulture_executable = 'executable with spaces'
AssertLinter 'executable with spaces',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('executable with spaces') . ' .'
Execute(The vulture command callback should let you set options):
let g:ale_python_vulture_options = '--some-option'
AssertLinter 'vulture',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('vulture') . ' --some-option .'
Execute(The vulture command callback should detect virtualenv directories and switch to the project root):
@@ -64,5 +64,5 @@ Execute(Setting executable to 'pipenv' appends 'run vulture'):
let g:ale_python_vulture_executable = 'path/to/pipenv'
AssertLinter 'path/to/pipenv',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
\ . ale#Escape('path/to/pipenv') . ' run vulture' . ' .'