summaryrefslogtreecommitdiff
path: root/test/command_callback
diff options
context:
space:
mode:
Diffstat (limited to 'test/command_callback')
-rwxr-xr-xtest/command_callback/psalm-project/vendor/bin/psalm-language-server0
-rw-r--r--test/command_callback/stack_build_paths/stack.yaml0
-rw-r--r--test/command_callback/stack_ghc_paths/stack.yaml0
-rw-r--r--test/command_callback/test_c_cppcheck_command_callbacks.vader2
-rw-r--r--test/command_callback/test_cpp_cppcheck_command_callbacks.vader2
-rw-r--r--test/command_callback/test_cs_mcsc_command_callbacks.vader14
-rw-r--r--test/command_callback/test_gobuild_command_callback.vader6
-rw-r--r--test/command_callback/test_golangci_lint_command_callback.vader8
-rw-r--r--test/command_callback/test_gometalinter_command_callback.vader8
-rw-r--r--test/command_callback/test_gosimple_command_callback.vader2
-rw-r--r--test/command_callback/test_gotype_command_callback.vader2
-rw-r--r--test/command_callback/test_govet_command_callback.vader6
-rw-r--r--test/command_callback/test_haskell_stack_build_command_callback.vader13
-rw-r--r--test/command_callback/test_haskell_stack_ghc_command_callback.vader14
-rw-r--r--test/command_callback/test_javac_command_callback.vader12
-rw-r--r--test/command_callback/test_lintr_command_callback.vader6
-rw-r--r--test/command_callback/test_mypy_command_callback.vader18
-rw-r--r--test/command_callback/test_psalm_command_callbacks.vader25
-rw-r--r--test/command_callback/test_sasslint_command_callback.vader2
-rw-r--r--test/command_callback/test_shellcheck_command_callback.vader2
-rw-r--r--test/command_callback/test_staticcheck_command_callback.vader6
-rw-r--r--test/command_callback/test_tslint_command_callback.vader6
22 files changed, 99 insertions, 55 deletions
diff --git a/test/command_callback/psalm-project/vendor/bin/psalm-language-server b/test/command_callback/psalm-project/vendor/bin/psalm-language-server
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/psalm-project/vendor/bin/psalm-language-server
diff --git a/test/command_callback/stack_build_paths/stack.yaml b/test/command_callback/stack_build_paths/stack.yaml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/stack_build_paths/stack.yaml
diff --git a/test/command_callback/stack_ghc_paths/stack.yaml b/test/command_callback/stack_ghc_paths/stack.yaml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/stack_ghc_paths/stack.yaml
diff --git a/test/command_callback/test_c_cppcheck_command_callbacks.vader b/test/command_callback/test_c_cppcheck_command_callbacks.vader
index 3fc87a79..3ae4bdbe 100644
--- a/test/command_callback/test_c_cppcheck_command_callbacks.vader
+++ b/test/command_callback/test_c_cppcheck_command_callbacks.vader
@@ -19,6 +19,6 @@ Execute(cppcheck for C++ should detect compile_commands.json files):
call ale#test#SetFilename('cppcheck_paths/one/foo.cpp')
AssertLinter 'cppcheck',
- \ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/cppcheck_paths/one')) . ' && '
+ \ ale#path#CdString(ale#path#Simplify(g:dir . '/cppcheck_paths/one'))
\ . ale#Escape('cppcheck')
\ . ' -q --language=c --project=compile_commands.json --enable=style %t'
diff --git a/test/command_callback/test_cpp_cppcheck_command_callbacks.vader b/test/command_callback/test_cpp_cppcheck_command_callbacks.vader
index 3a7ada2c..352c88d5 100644
--- a/test/command_callback/test_cpp_cppcheck_command_callbacks.vader
+++ b/test/command_callback/test_cpp_cppcheck_command_callbacks.vader
@@ -17,6 +17,6 @@ Execute(cppcheck for C++ should detect compile_commands.json files):
call ale#test#SetFilename('cppcheck_paths/one/foo.cpp')
AssertLinter 'cppcheck',
- \ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/cppcheck_paths/one')) . ' && '
+ \ ale#path#CdString(ale#path#Simplify(g:dir . '/cppcheck_paths/one'))
\ . ale#Escape('cppcheck')
\ . ' -q --language=c++ --project=compile_commands.json --enable=style %t'
diff --git a/test/command_callback/test_cs_mcsc_command_callbacks.vader b/test/command_callback/test_cs_mcsc_command_callbacks.vader
index 20ddb28b..d15898e0 100644
--- a/test/command_callback/test_cs_mcsc_command_callbacks.vader
+++ b/test/command_callback/test_cs_mcsc_command_callbacks.vader
@@ -5,43 +5,43 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The mcsc linter should return the correct default command):
- AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
+ AssertLinter 'mcs', ale#path#CdString(g:dir)
\ . 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
Execute(The options should be be used in the command):
let g:ale_cs_mcsc_options = '-pkg:dotnet'
- AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
+ AssertLinter 'mcs', ale#path#CdString(g:dir)
\ . 'mcs -unsafe -pkg:dotnet -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
Execute(The souce path should be be used in the command):
let g:ale_cs_mcsc_source = '../foo/bar'
- AssertLinter 'mcs', 'cd ' . ale#Escape('../foo/bar') . ' && '
+ AssertLinter 'mcs', ale#path#CdString('../foo/bar')
\ . 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
Execute(The list of search pathes for assemblies should be be used in the command if not empty):
let g:ale_cs_mcsc_assembly_path = ['/usr/lib/mono', '../foo/bar']
- AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
+ AssertLinter 'mcs', ale#path#CdString(g:dir)
\ . 'mcs -unsafe'
\ . ' -lib:' . ale#Escape('/usr/lib/mono') . ',' . ale#Escape('../foo/bar')
\ . ' -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
let g:ale_cs_mcsc_assembly_path = []
- AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
+ AssertLinter 'mcs', ale#path#CdString(g:dir)
\ . 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
Execute(The list of assemblies should be be used in the command if not empty):
let g:ale_cs_mcsc_assemblies = ['foo.dll', 'bar.dll']
- AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
+ AssertLinter 'mcs', ale#path#CdString(g:dir)
\ . 'mcs -unsafe'
\ . ' -r:' . ale#Escape('foo.dll') . ',' . ale#Escape('bar.dll')
\ . ' -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
let g:ale_cs_mcsc_assemblies = []
- AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
+ AssertLinter 'mcs', ale#path#CdString(g:dir)
\ . 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
diff --git a/test/command_callback/test_gobuild_command_callback.vader b/test/command_callback/test_gobuild_command_callback.vader
index 8acbec56..c6e324f2 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',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . 'go test -c -o /dev/null ./'
Execute(Extra options should be supported):
let g:ale_go_gobuild_options = '--foo-bar'
AssertLinter 'go',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . 'go test --foo-bar -c -o /dev/null ./'
let g:ale_go_gobuild_options = ''
@@ -27,5 +27,5 @@ Execute(The executable should be configurable):
let g:ale_go_go_executable = 'foobar'
AssertLinter 'foobar',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . 'foobar test -c -o /dev/null ./'
diff --git a/test/command_callback/test_golangci_lint_command_callback.vader b/test/command_callback/test_golangci_lint_command_callback.vader
index b3805f3a..345f58b1 100644
--- a/test/command_callback/test_golangci_lint_command_callback.vader
+++ b/test/command_callback/test_golangci_lint_command_callback.vader
@@ -7,7 +7,7 @@ After:
Execute(The golangci-lint defaults should be correct):
AssertLinter 'golangci-lint',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . ale#Escape('golangci-lint')
\ . ' run ' . ale#Escape(expand('%' . ':t'))
\ . ' --enable-all'
@@ -16,7 +16,7 @@ Execute(The golangci-lint callback should use a configured executable):
let b:ale_go_golangci_lint_executable = 'something else'
AssertLinter 'something else',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . ale#Escape('something else')
\ . ' run ' . ale#Escape(expand('%' . ':t'))
\ . ' --enable-all'
@@ -25,7 +25,7 @@ Execute(The golangci-lint callback should use configured options):
let b:ale_go_golangci_lint_options = '--foobar'
AssertLinter 'golangci-lint',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . ale#Escape('golangci-lint')
\ . ' run ' . ale#Escape(expand('%' . ':t'))
\ . ' --foobar'
@@ -34,5 +34,5 @@ Execute(The golangci-lint `lint_package` option should use the correct command):
let b:ale_go_golangci_lint_package = 1
AssertLinter 'golangci-lint',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . 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 d788c5bd..88e86801 100644
--- a/test/command_callback/test_gometalinter_command_callback.vader
+++ b/test/command_callback/test_gometalinter_command_callback.vader
@@ -7,7 +7,7 @@ After:
Execute(The gometalinter defaults should be correct):
AssertLinter 'gometalinter',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . ale#Escape('gometalinter')
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
\ . ' .'
@@ -16,7 +16,7 @@ Execute(The gometalinter callback should use a configured executable):
let b:ale_go_gometalinter_executable = 'something else'
AssertLinter 'something else',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . ale#Escape('something else')
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
\ . ' .'
@@ -25,7 +25,7 @@ Execute(The gometalinter callback should use configured options):
let b:ale_go_gometalinter_options = '--foobar'
AssertLinter 'gometalinter',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . ale#Escape('gometalinter')
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
\ . ' --foobar' . ' .'
@@ -34,5 +34,5 @@ Execute(The gometalinter `lint_package` option should use the correct command):
let b:ale_go_gometalinter_lint_package = 1
AssertLinter 'gometalinter',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . ale#Escape('gometalinter') . ' .'
diff --git a/test/command_callback/test_gosimple_command_callback.vader b/test/command_callback/test_gosimple_command_callback.vader
index 7b8c66ae..59013df0 100644
--- a/test/command_callback/test_gosimple_command_callback.vader
+++ b/test/command_callback/test_gosimple_command_callback.vader
@@ -7,4 +7,4 @@ After:
Execute(The default gosimple command should be correct):
AssertLinter 'gosimple',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && gosimple .'
+ \ ale#path#CdString(expand('%:p:h')) . ' gosimple .'
diff --git a/test/command_callback/test_gotype_command_callback.vader b/test/command_callback/test_gotype_command_callback.vader
index da9ceaf3..1898a0cb 100644
--- a/test/command_callback/test_gotype_command_callback.vader
+++ b/test/command_callback/test_gotype_command_callback.vader
@@ -7,7 +7,7 @@ After:
Execute(The default gotype command should be correct):
AssertLinter 'gotype',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && gotype .'
+ \ ale#path#CdString(expand('%:p:h')) . ' gotype .'
Execute(The gotype callback should ignore test files):
call ale#test#SetFilename('bla_test.go')
diff --git a/test/command_callback/test_govet_command_callback.vader b/test/command_callback/test_govet_command_callback.vader
index ab93a5cb..a55c0812 100644
--- a/test/command_callback/test_govet_command_callback.vader
+++ b/test/command_callback/test_govet_command_callback.vader
@@ -8,12 +8,12 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The default command should be correct):
- AssertLinter 'go', 'cd ' . ale#Escape(expand('%:p:h')) . ' && go vet .'
+ AssertLinter 'go', ale#path#CdString(expand('%:p:h')) . ' go vet .'
Execute(Extra options should be supported):
let g:ale_go_govet_options = '--foo-bar'
- AssertLinter 'go', 'cd ' . ale#Escape(expand('%:p:h')) . ' && go vet --foo-bar .'
+ AssertLinter 'go', ale#path#CdString(expand('%:p:h')) . ' go vet --foo-bar .'
Execute(The executable should be configurable):
let g:ale_go_go_executable = 'foobar'
- AssertLinter 'foobar', 'cd ' . ale#Escape(expand('%:p:h')) . ' && foobar vet .'
+ AssertLinter 'foobar', ale#path#CdString(expand('%:p:h')) . ' foobar vet .'
diff --git a/test/command_callback/test_haskell_stack_build_command_callback.vader b/test/command_callback/test_haskell_stack_build_command_callback.vader
new file mode 100644
index 00000000..f1e6f755
--- /dev/null
+++ b/test/command_callback/test_haskell_stack_build_command_callback.vader
@@ -0,0 +1,13 @@
+Before:
+ call ale#assert#SetUpLinterTest('haskell', 'stack_build')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The linter should not be executed when there's no stack.yaml file):
+ AssertLinterNotExecuted
+
+Execute(The linter should be executed when there is a stack.yaml file):
+ call ale#test#SetFilename('stack_build_paths/test.hs')
+
+ AssertLinter 'stack', 'stack build --fast'
diff --git a/test/command_callback/test_haskell_stack_ghc_command_callback.vader b/test/command_callback/test_haskell_stack_ghc_command_callback.vader
new file mode 100644
index 00000000..4adab583
--- /dev/null
+++ b/test/command_callback/test_haskell_stack_ghc_command_callback.vader
@@ -0,0 +1,14 @@
+Before:
+ call ale#assert#SetUpLinterTest('haskell', 'stack_ghc')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The linter should not be executed when there's no stack.yaml file):
+ AssertLinterNotExecuted
+
+Execute(The linter should be executed when there is a stack.yaml file):
+ call ale#test#SetFilename('stack_ghc_paths/test.hs')
+
+ AssertLinter 'stack', 'stack ghc -- -fno-code -v0 %t'
+
diff --git a/test/command_callback/test_javac_command_callback.vader b/test/command_callback/test_javac_command_callback.vader
index 07a0794a..2dcb6a1b 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 = 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ let g:prefix = ale#path#CdString(expand('%:p:h'))
\ . ale#Escape('javac') . ' -Xlint'
function! GetCommand(previous_output) abort
@@ -43,7 +43,7 @@ Execute(The executable should be configurable):
let g:ale_java_javac_executable = 'foobar'
AssertLinter 'foobar',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . ale#Escape('foobar') . ' -Xlint'
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
@@ -106,7 +106,7 @@ Execute(The javac callback should detect source directories):
call ale#engine#InitBufferInfo(bufnr(''))
AssertLinter 'javac',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' . ale#Escape('javac') . ' -Xlint'
+ \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
\ . ' -sourcepath ' . ale#Escape(
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/')
\ )
@@ -124,7 +124,7 @@ Execute(The javac callback should combine detected source directories and classp
\ '/xyz/abc.jar',
\]
AssertLinter 'javac',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' . ale#Escape('javac') . ' -Xlint'
+ \ ale#path#CdString(expand('%:p:h')) . 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/')
@@ -147,7 +147,7 @@ Execute(The javac callback should include src/test/java for test paths):
call ale#engine#InitBufferInfo(bufnr(''))
AssertLinter 'javac',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' . ale#Escape('javac') . ' -Xlint'
+ \ ale#path#CdString(expand('%:p:h')) . 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/'),
@@ -160,7 +160,7 @@ Execute(The javac callback should include src/main/jaxb when available):
call ale#engine#InitBufferInfo(bufnr(''))
AssertLinter 'javac',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' . ale#Escape('javac') . ' -Xlint'
+ \ ale#path#CdString(expand('%:p:h')) . 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/'),
diff --git a/test/command_callback/test_lintr_command_callback.vader b/test/command_callback/test_lintr_command_callback.vader
index 8a0e6c1c..187d3875 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',
- \ 'cd ' . ale#Escape(getcwd()) . ' && '
+ \ ale#path#CdString(getcwd())
\ . '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',
- \ 'cd ' . ale#Escape(getcwd()) . ' && '
+ \ ale#path#CdString(getcwd())
\ . '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',
- \ 'cd ' . ale#Escape(getcwd()) . ' && '
+ \ ale#path#CdString(getcwd())
\ . 'Rscript --vanilla -e '
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
\ . 'lint_package(cache = FALSE, '
diff --git a/test/command_callback/test_mypy_command_callback.vader b/test/command_callback/test_mypy_command_callback.vader
index 037d8176..8ca35207 100644
--- a/test/command_callback/test_mypy_command_callback.vader
+++ b/test/command_callback/test_mypy_command_callback.vader
@@ -12,7 +12,7 @@ After:
Execute(The mypy callbacks should return the correct default values):
AssertLinter 'mypy',
- \ 'cd ' . ale#Escape(g:dir) . ' && ' . ale#Escape('mypy')
+ \ ale#path#CdString(g:dir) . ale#Escape('mypy')
\ . ' --show-column-numbers '
\ . '--shadow-file %s %t %s'
@@ -20,7 +20,7 @@ Execute(The mypy executable should be configurable, and escaped properly):
let g:ale_python_mypy_executable = 'executable with spaces'
AssertLinter 'executable with spaces',
- \ 'cd ' . ale#Escape(g:dir) . ' && ' . ale#Escape('executable with spaces')
+ \ ale#path#CdString(g:dir) . ale#Escape('executable with spaces')
\ . ' --show-column-numbers '
\ . '--shadow-file %s %t %s'
@@ -28,7 +28,7 @@ Execute(The mypy command callback should let you set options):
let g:ale_python_mypy_options = '--some-option'
AssertLinter 'mypy',
- \ 'cd ' . ale#Escape(g:dir) . ' && ' . ale#Escape('mypy')
+ \ ale#path#CdString(g:dir) . ale#Escape('mypy')
\ . ' --show-column-numbers --some-option '
\ . '--shadow-file %s %t %s'
@@ -36,8 +36,8 @@ Execute(The mypy command should switch directories to the detected project root)
silent execute 'file ' . fnameescape(g:dir . '/python_paths/no_virtualenv/subdir/foo/bar.py')
AssertLinter 'mypy',
- \ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/no_virtualenv/subdir'))
- \ . ' && ' . ale#Escape('mypy')
+ \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/no_virtualenv/subdir'))
+ \ . ale#Escape('mypy')
\ . ' --show-column-numbers '
\ . '--shadow-file %s %t %s'
@@ -47,8 +47,8 @@ Execute(The mypy callbacks should detect virtualenv directories and switch to th
let b:executable = ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/mypy')
AssertLinter b:executable,
- \ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir'))
- \ . ' && ' . ale#Escape(b:executable)
+ \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir'))
+ \ . ale#Escape(b:executable)
\ . ' --show-column-numbers '
\ . '--shadow-file %s %t %s'
@@ -57,8 +57,8 @@ Execute(You should able able to use the global mypy instead):
let g:ale_python_mypy_use_global = 1
AssertLinter 'mypy',
- \ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir'))
- \ . ' && ' . ale#Escape('mypy')
+ \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir'))
+ \ . ale#Escape('mypy')
\ . ' --show-column-numbers '
\ . '--shadow-file %s %t %s'
diff --git a/test/command_callback/test_psalm_command_callbacks.vader b/test/command_callback/test_psalm_command_callbacks.vader
index 4c31b7b4..d731054f 100644
--- a/test/command_callback/test_psalm_command_callbacks.vader
+++ b/test/command_callback/test_psalm_command_callbacks.vader
@@ -2,11 +2,28 @@ Before:
call ale#assert#SetUpLinterTest('php', 'psalm')
After:
+ if isdirectory(g:dir . '/.git')
+ call delete(g:dir . '/.git', 'd')
+ endif
+
call ale#assert#TearDownLinterTest()
-Execute(Custom executables should be used for the executable and command):
- let g:ale_php_psalm_executable = 'psalm_test'
+Execute(The default executable path should be correct):
+ AssertLinter 'psalm-language-server',
+ \ ale#Escape('psalm-language-server')
+
+Execute(Vendor executables should be detected):
+ call ale#test#SetFilename('psalm-project/test.php')
+
+ AssertLinter
+ \ ale#path#Simplify(g:dir . '/psalm-project/vendor/bin/psalm-language-server'),
+ \ ale#Escape(ale#path#Simplify(
+ \ g:dir
+ \ . '/psalm-project/vendor/bin/psalm-language-server'
+ \ ))
- AssertLinter 'psalm_test',
- \ ale#Escape('psalm_test') . ' --diff --output-format=emacs %s'
+Execute(The project path should be correct for .git directories):
+ call ale#test#SetFilename('psalm-project/test.php')
+ call mkdir(g:dir . '/.git')
+ AssertLSPProject g:dir \ No newline at end of file
diff --git a/test/command_callback/test_sasslint_command_callback.vader b/test/command_callback/test_sasslint_command_callback.vader
index 4d7cc4c7..9142c441 100644
--- a/test/command_callback/test_sasslint_command_callback.vader
+++ b/test/command_callback/test_sasslint_command_callback.vader
@@ -7,5 +7,5 @@ After:
Execute(The default sasslint command should be correct):
AssertLinter 'sass-lint',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . ale#Escape('sass-lint') . ' -v -q -f compact %t'
diff --git a/test/command_callback/test_shellcheck_command_callback.vader b/test/command_callback/test_shellcheck_command_callback.vader
index 23684026..22a9ccb5 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 = 'cd ' . ale#Escape(ale#path#Simplify(g:dir)) . ' && '
+ let b:prefix = ale#path#CdString(ale#path#Simplify(g:dir))
let b:suffix = ' -f gcc -'
After:
diff --git a/test/command_callback/test_staticcheck_command_callback.vader b/test/command_callback/test_staticcheck_command_callback.vader
index 918c12a0..7f17b146 100644
--- a/test/command_callback/test_staticcheck_command_callback.vader
+++ b/test/command_callback/test_staticcheck_command_callback.vader
@@ -7,7 +7,7 @@ After:
Execute(The staticcheck callback should return the right defaults):
AssertLinter 'staticcheck',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . 'staticcheck '
\ . ale#Escape(expand('%' . ':t'))
@@ -15,7 +15,7 @@ Execute(The staticcheck callback should use configured options):
let b:ale_go_staticcheck_options = '-test'
AssertLinter 'staticcheck',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . 'staticcheck '
\ . '-test ' . ale#Escape(expand('%' . ':t'))
@@ -23,4 +23,4 @@ Execute(The staticcheck `lint_package` option should use the correct command):
let b:ale_go_staticcheck_lint_package = 1
AssertLinter 'staticcheck',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && staticcheck .',
+ \ ale#path#CdString(expand('%:p:h')) . 'staticcheck .',
diff --git a/test/command_callback/test_tslint_command_callback.vader b/test/command_callback/test_tslint_command_callback.vader
index bd8a12ec..229ccc96 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',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . 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',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . 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',
- \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ ale#path#CdString(expand('%:p:h'))
\ . ale#Escape('foo bar') . ' --format json %t'