diff options
author | w0rp <devw0rp@gmail.com> | 2023-09-16 22:22:01 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2023-09-16 22:23:30 +0100 |
commit | ae1d0515049ed135878672e06b51b083f5ae384d (patch) | |
tree | 1556645edaf786bc934be9cc8cc63408e65054d4 /test/linter | |
parent | 4b11cf21dc8406b579b89e50ae3f08ef2c0856e1 (diff) | |
download | ale-ae1d0515049ed135878672e06b51b083f5ae384d.zip |
#4454 Clean up more tests and code
* Remove some tests we no longer need
* Delete blocks of redundant code
* Compress some tests together to simplify them
* Remove a little code for ancient linter versions
* Escape more executables we didn't escape before
* Rename a deno option that didn't match our conventions
Diffstat (limited to 'test/linter')
44 files changed, 150 insertions, 318 deletions
diff --git a/test/linter/test_asciidoc_textlint.vader b/test/linter/test_asciidoc_textlint.vader index a79a0ae3..7e8b904f 100644 --- a/test/linter/test_asciidoc_textlint.vader +++ b/test/linter/test_asciidoc_textlint.vader @@ -18,7 +18,6 @@ Before: unlet! b:ale_textlint_options After: - unlet! b:command_tail unlet! b:ale_textlint_executable unlet! b:ale_textlint_use_global unlet! b:ale_textlint_options @@ -29,17 +28,12 @@ Execute(The default command should be correct): AssertLinter 'textlint', \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s' -Execute(The executable should be configurable): +Execute(The executable and options should be configurable): let b:ale_textlint_executable = 'foobar' - - AssertLinter 'foobar', - \ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s' - -Execute(The options should be configurable): let b:ale_textlint_options = '--something' - AssertLinter 'textlint', - \ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s' + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' --something -f json --stdin --stdin-filename %s' Execute(The local executable from .bin should be used if available): call ale#test#SetFilename('../test-files/textlint/with_bin_path/foo.txt') diff --git a/test/linter/test_asm_gcc.vader b/test/linter/test_asm_gcc.vader index 5976b5f2..c7ca44cf 100644 --- a/test/linter/test_asm_gcc.vader +++ b/test/linter/test_asm_gcc.vader @@ -11,9 +11,10 @@ After: call ale#assert#TearDownLinterTest() -Execute(The executable should be configurable): +Execute(The default command should be correct): AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail +Execute(The executable should be configurable): let b:ale_asm_gcc_executable = 'foobar' AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail diff --git a/test/linter/test_bingo.vader b/test/linter/test_bingo.vader index d8328414..9e719097 100644 --- a/test/linter/test_bingo.vader +++ b/test/linter/test_bingo.vader @@ -15,27 +15,14 @@ After: call ale#assert#TearDownLinterTest() -Execute(should set correct defaults): +Execute(The default bingo executable and options should be correct): AssertLinter 'bingo', ale#Escape('bingo') . ' --mode stdio' -Execute(should configure bingo callback executable): +Execute(The bingo executable and options should be configurable): let b:ale_go_bingo_executable = 'boo' - let b:ale_go_bingo_options = '' - - AssertLinter 'boo', ale#Escape('boo') - -Execute(should set bingo options): - call ale#test#SetFilename('../test-files/go/go1/prj1/file.go') - " let b:ale_completion_enabled = 1 - let b:ale_go_bingo_options = '' - - AssertLinter 'bingo', - \ ale#Escape('bingo') . '' - let b:ale_go_bingo_options = '--mode stdio --trace' - AssertLinter 'bingo', - \ ale#Escape('bingo') . ' --mode stdio --trace' + AssertLinter 'boo', ale#Escape('boo') . ' --mode stdio --trace' Execute(should support Go environment variables): call ale#test#SetFilename('../test-files/go/go1/prj1/file.go') @@ -44,7 +31,6 @@ Execute(should support Go environment variables): AssertLinter 'bingo', \ ale#Env('GO111MODULE', 'on') . ale#Escape('bingo') . ' --mode stdio' - Execute(Should return directory for 'go.mod' if found in parent directory): call ale#test#SetFilename('../test-files/go/test.go') diff --git a/test/linter/test_bitbake.vader b/test/linter/test_bitbake.vader index ba502aa0..62d5fcea 100755 --- a/test/linter/test_bitbake.vader +++ b/test/linter/test_bitbake.vader @@ -1,13 +1,13 @@ Before: - call ale#assert#SetUpLinterTest('bitbake', 'oelint_adv') + call ale#assert#SetUpLinterTest('bitbake', 'oelint_adv') After: - call ale#assert#TearDownLinterTest() + call ale#assert#TearDownLinterTest() Execute(The default command should be correct): - AssertLinter 'oelint-adv', ale#Escape('oelint-adv') . ' --quiet %s' + AssertLinter 'oelint-adv', ale#Escape('oelint-adv') . ' --quiet %s' Execute(The executable should be configurable): - let b:ale_bitbake_oelint_adv_executable = 'xyz' + let b:ale_bitbake_oelint_adv_executable = 'xyz' - AssertLinter 'xyz', ale#Escape('xyz') . ' --quiet %s' + AssertLinter 'xyz', ale#Escape('xyz') . ' --quiet %s' diff --git a/test/linter/test_bzl_buildifier.vader b/test/linter/test_bzl_buildifier.vader index 1fe9c830..d2d39632 100644 --- a/test/linter/test_bzl_buildifier.vader +++ b/test/linter/test_bzl_buildifier.vader @@ -4,7 +4,6 @@ Before: After: call ale#assert#TearDownLinterTest() - Execute(Should use default command when bazel_buildifier_options are not set): call ale#test#SetDirectory('/testplugin/test/test-files/bzl/bazel-package') call ale#test#SetFilename('BUILD.bazel') diff --git a/test/linter/test_c_clang_tidy.vader b/test/linter/test_c_clang_tidy.vader index c4433550..2dfb3494 100644 --- a/test/linter/test_c_clang_tidy.vader +++ b/test/linter/test_c_clang_tidy.vader @@ -12,12 +12,6 @@ Execute(The clangtidy command default should be correct): AssertLinter 'clang-tidy', \ ale#Escape('clang-tidy') . ' %s' -Execute(You should be able to remove the -checks option for clang-tidy): - let b:ale_c_clangtidy_checks = [] - - AssertLinter 'clang-tidy', - \ ale#Escape('clang-tidy') . ' %s' - Execute(You should be able to set other checks for clang-tidy): let b:ale_c_clangtidy_checks = ['-*', 'clang-analyzer-*'] diff --git a/test/linter/test_c_flawfinder.vader b/test/linter/test_c_flawfinder.vader index 6ef2a40d..75626d7a 100644 --- a/test/linter/test_c_flawfinder.vader +++ b/test/linter/test_c_flawfinder.vader @@ -4,7 +4,7 @@ Before: After: call ale#assert#TearDownLinterTest() -Execute(The flawfinder command should be correct): +Execute(The default flawfinder command should be correct): AssertLinter 'flawfinder', ale#Escape('flawfinder') . ' -CDQS --minlevel=1 %t' Execute(The minlevel of flawfinder should be configurable): @@ -13,12 +13,7 @@ Execute(The minlevel of flawfinder should be configurable): AssertLinter 'flawfinder', ale#Escape('flawfinder') . ' -CDQS --minlevel=8 %t' Execute(Additional flawfinder options should be configurable): + let b:ale_c_flawfinder_executable = 'foo' let b:ale_c_flawfinder_options = '--foobar' - AssertLinter 'flawfinder', - \ ale#Escape('flawfinder') . ' -CDQS --foobar --minlevel=1 %t' - -Execute(The flawfinder executable should be configurable): - let b:ale_c_flawfinder_executable = 'foo/bar' - - AssertLinter 'foo/bar', ale#Escape('foo/bar') . ' -CDQS --minlevel=1 %t' + AssertLinter 'foo', ale#Escape('foo') . ' -CDQS --foobar --minlevel=1 %t' diff --git a/test/linter/test_clang_tidy.vader b/test/linter/test_clang_tidy.vader index eb1220be..f7f0aa74 100644 --- a/test/linter/test_clang_tidy.vader +++ b/test/linter/test_clang_tidy.vader @@ -12,12 +12,6 @@ Execute(The clangtidy command default should be correct): AssertLinter 'clang-tidy', \ ale#Escape('clang-tidy') . ' %s' -Execute(You should be able to remove the -checks option for clang-tidy): - let b:ale_cpp_clangtidy_checks = [] - - AssertLinter 'clang-tidy', - \ ale#Escape('clang-tidy') . ' %s' - Execute(You should be able to set other checks for clang-tidy): let b:ale_cpp_clangtidy_checks = ['-*', 'clang-analyzer-*'] diff --git a/test/linter/test_cookstyle.vader b/test/linter/test_cookstyle.vader index ad7391cc..ccd6b1a2 100644 --- a/test/linter/test_cookstyle.vader +++ b/test/linter/test_cookstyle.vader @@ -4,16 +4,11 @@ Before: After: call ale#assert#TearDownLinterTest() -Execute(The default command should be correct): +Execute(The default cookstyle command should be correct): AssertLinter 'cookstyle', ale#Escape('cookstyle') . ' --force-exclusion --format json --stdin %s' -Execute(The executable path should be configurable): +Execute(The cookstyle executable and options should be configurable): let b:ale_chef_cookstyle_executable = 'foobar' - - AssertLinter 'foobar', ale#Escape('foobar') . ' --force-exclusion --format json --stdin %s' - -Execute(The linter options should be configurable): let b:ale_chef_cookstyle_options = '--parallel' - AssertLinter 'cookstyle', ale#Escape('cookstyle') . ' --parallel --force-exclusion --format json --stdin %s' - + AssertLinter 'foobar', ale#Escape('foobar') . ' --parallel --force-exclusion --format json --stdin %s' diff --git a/test/linter/test_cspell.vader b/test/linter/test_cspell.vader index 0302edc5..48dee7ce 100644 --- a/test/linter/test_cspell.vader +++ b/test/linter/test_cspell.vader @@ -68,4 +68,3 @@ Execute(Additional cspell options should be configurable): \ 'cspell', \ ale#Escape('cspell') \ . ' lint --no-color --no-progress --no-summary --foobar -- stdin' - diff --git a/test/linter/test_cypher_cypher_lint.vader b/test/linter/test_cypher_lint.vader index 6b64dc1f..6b64dc1f 100644 --- a/test/linter/test_cypher_cypher_lint.vader +++ b/test/linter/test_cypher_lint.vader diff --git a/test/linter/test_eclipselsp.vader b/test/linter/test_eclipselsp.vader index 6bbc4053..393621bd 100644 --- a/test/linter/test_eclipselsp.vader +++ b/test/linter/test_eclipselsp.vader @@ -4,12 +4,12 @@ Before: let b:ale_java_eclipselsp_path = '/home/user/eclipse.dst.ls' - let b:cfg = ale#path#Simplify(g:dir . '/../config_linux') - if has('win32') let b:cfg = ale#path#Simplify(g:dir . '/../config_win') elseif has('macunix') let b:cfg = ale#path#Simplify(g:dir . '/../config_mac') + else + let b:cfg = ale#path#Simplify(g:dir . '/../config_linux') endif After: diff --git a/test/linter/test_embertemplatelint.vader b/test/linter/test_embertemplatelint.vader index 7cba83e2..4efb0f0a 100644 --- a/test/linter/test_embertemplatelint.vader +++ b/test/linter/test_embertemplatelint.vader @@ -10,14 +10,8 @@ Execute(Runs the right command for ember-template-lint >= 4.x): AssertLinter 'ember-template-lint', \ ale#Escape('ember-template-lint') . ' --format=json --filename %s' -Execute(Runs the right command for ember-template-lint >= 1.6, < 4.x): - GivenCommandOutput ['1.6.0'] - - AssertLinter 'ember-template-lint', - \ ale#Escape('ember-template-lint') . ' --json --filename %s' - -Execute(Runs the right command for ember-template-lint < 1.6): - GivenCommandOutput ['1.5.0'] +Execute(Runs the right command for ember-template-lint < 4.x): + GivenCommandOutput ['3.14.0'] AssertLinter 'ember-template-lint', - \ ale#Escape('ember-template-lint') . ' --json %t' + \ ale#Escape('ember-template-lint') . ' --json --filename %s' diff --git a/test/linter/test_foodcritic.vader b/test/linter/test_foodcritic.vader index c5564cb1..b3b9b207 100644 --- a/test/linter/test_foodcritic.vader +++ b/test/linter/test_foodcritic.vader @@ -4,15 +4,12 @@ Before: After: call ale#assert#TearDownLinterTest() -Execute(The default command should be correct): +Execute(The default foodcritic command should be correct): AssertLinter 'foodcritic', ale#Escape('foodcritic') . ' %s' -Execute(Extra options should be included with escapeed tildes (~)): - let b:ale_chef_foodcritic_options = '-t ~F011' - - AssertLinter 'foodcritic', ale#Escape('foodcritic') . ' -t \~F011 %s' - -Execute(The executable should be configurable): +Execute(The foodcritic executable and options should be configurable): let b:ale_chef_foodcritic_executable = 'foobar' + " Tides should be escaped + let b:ale_chef_foodcritic_options = '-t ~F011' - AssertLinter 'foobar', ale#Escape('foobar') . ' %s' + AssertLinter 'foobar', ale#Escape('foobar') . ' -t \~F011 %s' diff --git a/test/linter/test_gfortran.vader b/test/linter/test_gfortran.vader index 3e6ef951..4c135de8 100644 --- a/test/linter/test_gfortran.vader +++ b/test/linter/test_gfortran.vader @@ -4,21 +4,17 @@ Before: After: call ale#assert#TearDownLinterTest() -Execute(The fortran gcc command callback should return the correct default string): +Execute(The default fortran gcc command should be correct): AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffree-form -Wall -' -Execute(The fortran gcc command callback should let you set options): +Execute(The fortran gcc executable and command should be configurable): + let g:ale_fortran_gcc_executable = 'gfortran' let g:ale_fortran_gcc_options = '-Wotherthings' - AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffree-form -Wotherthings -' + AssertLinter 'gfortran', ale#Escape('gfortran') + \ . ' -S -x f95 -fsyntax-only -ffree-form -Wotherthings -' -Execute(The fortran gcc command callback should let you use -ffixed-form): +Execute(The fortran gcc linter should allow you to use -ffixed-form): let g:ale_fortran_gcc_use_free_form = 0 AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffixed-form -Wall -' - -Execute(The fortran executable should be configurable): - let g:ale_fortran_gcc_executable = 'gfortran' - - AssertLinter 'gfortran', - \ ale#Escape('gfortran') . ' -S -x f95 -fsyntax-only -ffree-form -Wall -' diff --git a/test/linter/test_gobuild.vader b/test/linter/test_gobuild.vader index bac4d74e..cd2ca4ef 100644 --- a/test/linter/test_gobuild.vader +++ b/test/linter/test_gobuild.vader @@ -3,31 +3,24 @@ Before: call ale#assert#SetUpLinterTest('go', 'gobuild') - GivenCommandOutput ['/foo/bar', '/foo/baz'] - After: - Restore call ale#assert#TearDownLinterTest() -Execute(The default command should be correct): +Execute(The default go test command should be correct): AssertLinterCwd '%s:h' - AssertLinter 'go', 'go test -c -o /dev/null ./' + AssertLinter 'go', ale#Escape('go') . ' test -c -o /dev/null ./' Execute(Go environment variables should be supported): let b:ale_go_go111module = 'on' - AssertLinter 'go', ale#Env('GO111MODULE', 'on') . 'go test -c -o /dev/null ./' + AssertLinter 'go', ale#Env('GO111MODULE', 'on') + \ . ale#Escape('go') . ' test -c -o /dev/null ./' unlet! b:ale_go_go111module -Execute(Extra options should be supported): - let g:ale_go_gobuild_options = '--foo-bar' - - AssertLinter 'go', 'go test --foo-bar -c -o /dev/null ./' - - let g:ale_go_gobuild_options = '' - -Execute(The executable should be configurable): +Execute(The go test executable and options should be configurable): let g:ale_go_go_executable = 'foobar' + let g:ale_go_gobuild_options = '--foo-bar' - AssertLinter 'foobar', 'foobar test -c -o /dev/null ./' + AssertLinter 'foobar', ale#Escape('foobar') + \ . ' test --foo-bar -c -o /dev/null ./' diff --git a/test/linter/test_govet.vader b/test/linter/test_govet.vader index 12ec168a..0bd19c5b 100644 --- a/test/linter/test_govet.vader +++ b/test/linter/test_govet.vader @@ -12,21 +12,17 @@ After: call ale#assert#TearDownLinterTest() -Execute(The default command should be correct): - AssertLinter 'go', 'go vet .' - -Execute(Extra options should be supported): - let g:ale_go_govet_options = '--foo-bar' - +Execute(The default go vet command should be correct): + AssertLinter 'go', ale#Escape('go') . ' vet .' AssertLinterCwd '%s:h' - AssertLinter 'go', 'go vet --foo-bar .' -Execute(The executable should be configurable): +Execute(The go vet command and options should be configurable): let g:ale_go_go_executable = 'foobar' + let g:ale_go_govet_options = '--foo-bar' - AssertLinter 'foobar', 'foobar vet .' + AssertLinter 'foobar', ale#Escape('foobar') . ' vet --foo-bar .' Execute(Go environment variables should be supported): let b:ale_go_go111module = 'on' - AssertLinter 'go', ale#Env('GO111MODULE', 'on') . 'go vet .' + AssertLinter 'go', ale#Env('GO111MODULE', 'on') . ale#Escape('go') . ' vet .' diff --git a/test/linter/test_haskell_ghc.vader b/test/linter/test_haskell_ghc.vader index 2f33477d..746bc082 100644 --- a/test/linter/test_haskell_ghc.vader +++ b/test/linter/test_haskell_ghc.vader @@ -4,9 +4,10 @@ Before: After: call ale#assert#TearDownLinterTest() -Execute(The options should be used in the command): +Execute(The default ghc command should be correct): AssertLinter 'ghc', 'ghc -fno-code -v0 %t' +Execute(The ghc options should be configurable): let b:ale_haskell_ghc_options = 'foobar' AssertLinter 'ghc', 'ghc foobar %t' diff --git a/test/linter/test_haskell_hie.vader b/test/linter/test_haskell_hie.vader index 3cababad..ab71b6b3 100644 --- a/test/linter/test_haskell_hie.vader +++ b/test/linter/test_haskell_hie.vader @@ -1,9 +1,6 @@ Before: call ale#assert#SetUpLinterTest('haskell', 'hie') - Save &filetype - let &filetype = 'haskell' - After: call ale#assert#TearDownLinterTest() @@ -11,8 +8,7 @@ Execute(The language string should be correct): AssertLSPLanguage 'haskell' Execute(The default executable should be correct): - AssertLinter 'hie', - \ ale#Escape('hie') . ' --lsp' + AssertLinter 'hie', ale#Escape('hie') . ' --lsp' Execute(The project root should be detected correctly): AssertLSPProject g:dir diff --git a/test/linter/test_ispc_ispc.vader b/test/linter/test_ispc_ispc.vader index f1aeb2f8..9d91da8d 100644 --- a/test/linter/test_ispc_ispc.vader +++ b/test/linter/test_ispc_ispc.vader @@ -4,17 +4,11 @@ Before: After: call ale#assert#TearDownLinterTest() -Execute(The executable should be configurable): - AssertLinter 'ispc', - \ ale#Escape('ispc') . ' --nowrap %s' +Execute(The default ispc command should be configurable): + AssertLinter 'ispc', ale#Escape('ispc') . ' --nowrap %s' +Execute(The ispc executable nad options should be configurable): let b:ale_ispc_ispc_executable = 'foo' - - AssertLinter 'foo', - \ ale#Escape('foo') . ' --nowrap %s' - -Execute(The options should be configurable): let g:ale_ispc_ispc_options = '--foo' - AssertLinter 'ispc', - \ ale#Escape('ispc') . ' --nowrap --foo' . ' %s' + AssertLinter 'foo', ale#Escape('foo') . ' --nowrap --foo' . ' %s' diff --git a/test/linter/test_javalsp.vader b/test/linter/test_javalsp.vader index 122f409b..1435f9df 100644 --- a/test/linter/test_javalsp.vader +++ b/test/linter/test_javalsp.vader @@ -1,4 +1,3 @@ - Before: call ale#assert#SetUpLinterTest('java', 'javalsp') @@ -39,18 +38,6 @@ Execute(The javalsp should have default config): \ }, \ ale_linters#java#javalsp#Config(bufnr('')) -Execute(The javalsp should have default config if user sets empty hash): - let b:ale_java_javalsp_config = {} - - AssertEqual - \ { - \ 'java': { - \ 'classPath': [], - \ 'externalDependencies': [] - \ } - \ }, - \ ale_linters#java#javalsp#Config(bufnr('')) - Execute(The javalsp should have add missing config): let b:ale_java_javalsp_config = { 'java': { 'classPath': ['aaa.jar'] } } diff --git a/test/linter/test_javascript_deno_lsp.vader b/test/linter/test_javascript_deno_lsp.vader index 965ce600..c48d52cc 100644 --- a/test/linter/test_javascript_deno_lsp.vader +++ b/test/linter/test_javascript_deno_lsp.vader @@ -1,5 +1,10 @@ Before: - let g:ale_deno_importMap = 'import_map.json' + Save g:ale_deno_import_map + Save g:ale_deno_unstable + Save g:ale_deno_executable + Save g:ale_deno_lsp_project_root + + let g:ale_deno_import_map = 'import_map.json' let g:ale_deno_unstable = 0 let g:ale_deno_executable = 'deno' let g:ale_deno_lsp_project_root = '' @@ -39,7 +44,7 @@ Execute(Should set the default importMap filepath): \} Execute(Should set the importMap filepath from user defined importMap): - let g:ale_deno_importMap = 'custom_import_map.json' + let g:ale_deno_import_map = 'custom_import_map.json' call ale#test#SetFilename('../test-files/javascript_deno/main.js') AssertLSPOptions { @@ -50,7 +55,7 @@ Execute(Should set the importMap filepath from user defined importMap): \} Execute(Should set the importMap filepath from user defined importMap with unstable API): - let g:ale_deno_importMap = 'custom_import_map.json' + let g:ale_deno_import_map = 'custom_import_map.json' let g:ale_deno_unstable = 1 call ale#test#SetFilename('../test-files/javascript_deno/main.js') diff --git a/test/linter/test_languagetool.vader b/test/linter/test_languagetool.vader index ff6b2064..9893138d 100644 --- a/test/linter/test_languagetool.vader +++ b/test/linter/test_languagetool.vader @@ -1,8 +1,14 @@ Before: - call ale#assert#SetUpLinterTest('text', 'languagetool') + Save g:ale_languagetool_executable + Save g:ale_languagetool_options + + let g:ale_languagetool_executable = 'languagetool' + let g:ale_languagetool_options = '--autoDetect' + + call ale#assert#SetUpLinterTest('text', 'languagetool') After: - call ale#assert#TearDownLinterTest() + call ale#assert#TearDownLinterTest() Execute(The default command should be correct): AssertLinter 'languagetool', ale#Escape('languagetool') @@ -10,13 +16,7 @@ Execute(The default command should be correct): Execute(Should be able to set a custom executable): let g:ale_languagetool_executable = 'foobar' - - AssertLinter 'foobar' , ale#Escape('foobar') - \ . ' --autoDetect %s' - -Execute(Should be able to include custom languagetool options): let g:ale_languagetool_options = '--language en' - " is now 'foobar' based on above global - AssertLinter 'foobar', ale#Escape('foobar') + AssertLinter 'foobar' , ale#Escape('foobar') \ . ' --language en %s' diff --git a/test/linter/test_llvm_mc.vader b/test/linter/test_llvm_mc.vader index 6d896b26..c77eaa0e 100644 --- a/test/linter/test_llvm_mc.vader +++ b/test/linter/test_llvm_mc.vader @@ -11,9 +11,10 @@ After: call ale#assert#TearDownLinterTest() -Execute(The executable should be configurable): +Execute(The default llvm-mc command should be correct): AssertLinter 'llvm-mc', ale#Escape('llvm-mc') . b:command_tail +Execute(The llvm-mc executable should be configurable): let b:ale_asm_llvm_mc_executable = 'foobar' AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail diff --git a/test/linter/test_markdown_markdownlint.vader b/test/linter/test_markdown_markdownlint.vader index b938ac41..7ec626ee 100644 --- a/test/linter/test_markdown_markdownlint.vader +++ b/test/linter/test_markdown_markdownlint.vader @@ -4,15 +4,11 @@ Before: After: call ale#assert#TearDownLinterTest() -Execute(The default command should be correct): +Execute(The default markdownlint command should be correct): AssertLinter 'markdownlint', ale#Escape('markdownlint') . ' %s' Execute(The executable should be configurable): let g:ale_markdown_markdownlint_executable = 'foo bar' + let g:ale_markdown_markdownlint_options = '--option' - AssertLinter 'foo bar', ale#Escape('foo bar') . ' %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' + AssertLinter 'foo bar', ale#Escape('foo bar') . ' --option %s' diff --git a/test/linter/test_nagelfar.vader b/test/linter/test_nagelfar.vader index 94bb1d53..c7afdacc 100644 --- a/test/linter/test_nagelfar.vader +++ b/test/linter/test_nagelfar.vader @@ -6,14 +6,11 @@ After: call ale#assert#TearDownLinterTest() -Execute(The executable should be configurable): +Execute(The default nagelfar command should be correct): AssertLinter 'nagelfar.tcl', ale#Escape('nagelfar.tcl') . ' %s' +Execute(The negalfar executable and options should be configurable): let b:ale_tcl_nagelfar_executable = 'foobar' - - AssertLinter 'foobar', ale#Escape('foobar') . ' %s' - -Execute(The options should be configurable): let b:ale_tcl_nagelfar_options = '--something' - AssertLinter 'nagelfar.tcl', ale#Escape('nagelfar.tcl') . ' --something %s' + AssertLinter 'foobar', ale#Escape('foobar') . ' --something %s' diff --git a/test/linter/test_nasm_nasm.vader b/test/linter/test_nasm_nasm.vader index 2bfe2b0d..ef56aa28 100644 --- a/test/linter/test_nasm_nasm.vader +++ b/test/linter/test_nasm_nasm.vader @@ -1,32 +1,19 @@ Before: call ale#assert#SetUpLinterTest('nasm', 'nasm') - let b:command_tail = - \ ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null') - let b:command_tail_opt = - \ ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') . ' -w+orphan-labels %s -o ' . (has('win32') ? 'NUL' : '/dev/null') - After: - unlet! b:command_tail - unlet! b:command_tail_opt - call ale#assert#TearDownLinterTest() -Execute(The executable should be configurable): - AssertLinter 'nasm', ale#Escape('nasm') . b:command_tail, +Execute(The default nasm command should be correct): + AssertLinter 'nasm', ale#Escape('nasm') + \ . ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') + \ . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null') +Execute(The nasm executable and options should be configurable): let b:ale_nasm_nasm_executable = '~/nasm' - - AssertLinter '~/nasm', ale#Escape('~/nasm') . b:command_tail - -Execute(The options should be configurable): let b:ale_nasm_nasm_options = '-w-macro-params' - AssertLinter 'nasm', ale#Escape('nasm') + AssertLinter '~/nasm', ale#Escape('~/nasm') \ . ' -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' - - AssertLinter 'nasm', ale#Escape('nasm') . b:command_tail_opt + \ . ' -w-macro-params' + \ . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null') diff --git a/test/linter/test_nix_statix.vader b/test/linter/test_nix_statix.vader index 8ee4c027..a6a389d5 100644 --- a/test/linter/test_nix_statix.vader +++ b/test/linter/test_nix_statix.vader @@ -4,16 +4,11 @@ Before: After: call ale#assert#TearDownLinterTest() -Execute(The statix command should be correct): +Execute(The default statix command should be correct): AssertLinter 'statix', ale#Escape('statix') . ' check -o errfmt --stdin' -Execute(Additional statix options should be configurable): +Execute(The statix executable and options should be configurable): + let g:ale_nix_statix_check_executable = 'foo' let g:ale_nix_statix_check_options = '--foobar' - AssertLinter 'statix', - \ ale#Escape('statix') . ' check -o errfmt --stdin --foobar' - -Execute(The statix command should be configurable): - let g:ale_nix_statix_check_executable = 'foo/bar' - - AssertLinter 'foo/bar', ale#Escape('foo/bar') . ' check -o errfmt --stdin' + AssertLinter 'foo', ale#Escape('foo') . ' check -o errfmt --stdin --foobar' diff --git a/test/linter/test_npmgroovylint.vader b/test/linter/test_npmgroovylint.vader index 25195861..e87b209b 100644 --- a/test/linter/test_npmgroovylint.vader +++ b/test/linter/test_npmgroovylint.vader @@ -5,8 +5,6 @@ Before: call ale#test#SetFilename('test.groovy') After: - Restore - call ale#assert#TearDownLinterTest() Execute(The default npm-groovy-lint command should be correct): diff --git a/test/linter/test_pony_ponyc.vader b/test/linter/test_pony_ponyc.vader index 3a3b32ec..18952db7 100644 --- a/test/linter/test_pony_ponyc.vader +++ b/test/linter/test_pony_ponyc.vader @@ -4,9 +4,11 @@ Before: After: call ale#assert#TearDownLinterTest() -Execute(The options should be used in the command): +Execute(The default ponyc command should be correct): AssertLinter 'ponyc', ale#Escape('ponyc') . ' --pass paint' - let b:ale_pony_ponyc_options = 'foobar' +Execute(The pony executable and options should be configurable): + let b:ale_pony_ponyc_executable = 'foobar' + let b:ale_pony_ponyc_options = '--some-option' - AssertLinter 'ponyc', ale#Escape('ponyc') . ' foobar' + AssertLinter 'foobar', ale#Escape('foobar') . ' --some-option' diff --git a/test/linter/test_pycln.vader b/test/linter/test_pycln.vader index 860cbbc0..eb04f3d5 100644 --- a/test/linter/test_pycln.vader +++ b/test/linter/test_pycln.vader @@ -33,7 +33,6 @@ Execute(pycln should run with the stdin in new enough versions): AssertLinterCwd expand('%:p:h') AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail[:-3] . ' -' - " AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail[:-3] . '--check -' Execute(The option for disabling changing directories should work): let g:ale_python_pycln_change_directory = 0 @@ -41,17 +40,11 @@ Execute(The option for disabling changing directories should work): AssertLinterCwd '' AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail -Execute(The pycln executable should be configurable, and escaped properly): - let g:ale_python_pycln_executable = 'executable with spaces' - - AssertLinter 'executable with spaces', ale#Escape('executable with spaces') . b:cmd_tail - -Execute(The pycln command callback should let you set options): +Execute(The pycln executable and options should be configurable): + let g:ale_python_pycln_executable = 'foo' let g:ale_python_pycln_options = '--some-flag' - AssertLinter 'pycln', ale#Escape('pycln') . ' --some-flag' . b:cmd_tail - let g:ale_python_pycln_options = '--some-option value' - AssertLinter 'pycln', ale#Escape('pycln') . ' --some-option value' . b:cmd_tail + AssertLinter 'foo', ale#Escape('foo') . ' --some-flag' . b:cmd_tail Execute(The pycln callbacks shouldn't detect virtualenv directories where they don't exist): call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py') @@ -121,4 +114,3 @@ Execute(configuration file set in _options overrides _config): let b:ale_python_pycln_options = '-x --config /bar.xml' AssertLinter 'pycln', ale#Escape('pycln') . ' -x --config /bar.xml' . b:cmd_tail - diff --git a/test/linter/test_pylsp.vader b/test/linter/test_pylsp.vader index 580cec17..c46c53a4 100644 --- a/test/linter/test_pylsp.vader +++ b/test/linter/test_pylsp.vader @@ -13,20 +13,17 @@ After: call ale#test#SetFilename('..') call ale#assert#TearDownLinterTest() -Execute(The pylsp command callback should return default string): +Execute(The default pylsp command should be correct): call ale#test#SetFilename('./foo.py') AssertLinter 'pylsp', ale#Escape('pylsp') -Execute(The pylsp executable should be configurable): +Execute(The pylsp command and executable should be configurable): let g:ale_python_pylsp_executable = '~/.local/bin/pylsp' - - AssertLinter '~/.local/bin/pylsp' , ale#Escape('~/.local/bin/pylsp') - -Execute(The pylsp command callback should let you set options): let g:ale_python_pylsp_options = '--some-option' - AssertLinter 'pylsp', ale#Escape('pylsp') . ' --some-option' + AssertLinter '~/.local/bin/pylsp' , ale#Escape('~/.local/bin/pylsp') + \ . ' --some-option' Execute(The cwd and project root should be detected correctly): call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') diff --git a/test/linter/test_rst_textlint.vader b/test/linter/test_rst_textlint.vader index b2d99636..66ab30e9 100644 --- a/test/linter/test_rst_textlint.vader +++ b/test/linter/test_rst_textlint.vader @@ -1,5 +1,4 @@ " Author: januswel, w0rp - Before: " This is just one language for the linter. call ale#assert#SetUpLinterTest('rst', 'textlint') @@ -18,28 +17,22 @@ Before: unlet! b:ale_textlint_options After: - unlet! b:command_tail unlet! b:ale_textlint_executable unlet! b:ale_textlint_use_global unlet! b:ale_textlint_options call ale#assert#TearDownLinterTest() -Execute(The default command should be correct): +Execute(The default textlint command should be correct): AssertLinter 'textlint', \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s' -Execute(The executable should be configurable): +Execute(The text executable and command should be configurable): let b:ale_textlint_executable = 'foobar' - - AssertLinter 'foobar', - \ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s' - -Execute(The options should be configurable): let b:ale_textlint_options = '--something' - AssertLinter 'textlint', - \ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s' + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' --something -f json --stdin --stdin-filename %s' Execute(The local executable from .bin should be used if available): call ale#test#SetFilename('../test-files/textlint/with_bin_path/foo.txt') diff --git a/test/linter/test_sql_sqlfluff.vader b/test/linter/test_sql_sqlfluff.vader index 9b474017..8fde882d 100644 --- a/test/linter/test_sql_sqlfluff.vader +++ b/test/linter/test_sql_sqlfluff.vader @@ -4,19 +4,12 @@ Before: After: call ale#assert#TearDownLinterTest() -Execute(The default command should be correct): +Execute(The default sqlfluff command should be correct): AssertLinter 'sqlfluff', \ ale#Escape('sqlfluff') \ . ' lint --dialect ansi --format json %t' -Execute(The executable should be configurable): - let g:ale_sql_sqlfluff_executable = 'foobar' - - AssertLinter 'foobar', - \ ale#Escape('foobar') - \ . ' lint --dialect ansi --format json %t' - -Execute(Overriding options should work): +Execute(The sqlfluff executable and command should be configurable): let g:ale_sql_sqlfluff_executable = 'foobar' let g:ale_sql_sqlfluff_options = '--whatever' diff --git a/test/linter/test_terraform_ls.vader b/test/linter/test_terraform_ls.vader index 983bc104..df0186c7 100644 --- a/test/linter/test_terraform_ls.vader +++ b/test/linter/test_terraform_ls.vader @@ -8,33 +8,28 @@ After: call ale#assert#TearDownLinterTest() -Execute(Should send correct LSP language): +Execute(The terraform-ls language should be correct): AssertLSPLanguage 'terraform' -Execute(Should load default executable): - AssertLinter 'terraform-ls', - \ ale#Escape('terraform-ls') . ' serve' +Execute(The default terraform-ls command should be correct): + AssertLinter 'terraform-ls', ale#Escape('terraform-ls') . ' serve' -Execute(Should configure custom executable): +Execute(The terrarform-ls executable and options should be configurable): let b:ale_terraform_ls_executable = 'foo' - AssertLinter 'foo', - \ ale#Escape('foo') . ' serve' + let b:ale_terraform_ls_options = '--bar' + + AssertLinter 'foo', ale#Escape('foo') . ' serve --bar' -Execute(Should ignore non-absolute custom terraform executable): +Execute(Should ignore non-absolute path custom terraform executables): let b:ale_terraform_terraform_executable = 'terraform' - AssertLinter 'terraform-ls', - \ ale#Escape('terraform-ls') . ' serve' + + AssertLinter 'terraform-ls', ale#Escape('terraform-ls') . ' serve' Execute(Should set absolute custom terraform executable): let b:ale_terraform_terraform_executable = '/bin/terraform' - AssertLinter 'terraform-ls', - \ ale#Escape('terraform-ls') . ' serve -tf-exec /bin/terraform' - -Execute(Should set custom options): - let b:ale_terraform_ls_options = '--bar' AssertLinter 'terraform-ls', - \ ale#Escape('terraform-ls') . ' serve --bar' + \ ale#Escape('terraform-ls') . ' serve -tf-exec /bin/terraform' Execute(Should return nearest directory with .terraform if found in parent directory): call ale#test#SetFilename('../test-files/terraform/main.tf') diff --git a/test/linter/test_terraform_tflint.vader b/test/linter/test_terraform_tflint.vader index b1963a77..c608bc8a 100644 --- a/test/linter/test_terraform_tflint.vader +++ b/test/linter/test_terraform_tflint.vader @@ -4,15 +4,10 @@ Before: After: call ale#assert#TearDownLinterTest() -Execute(The default command should be correct): +Execute(The default tflint command should be correct): AssertLinter 'tflint', ale#Escape('tflint') . ' -f json' -Execute(The default executable should be configurable): - let b:ale_terraform_tflint_executable = 'asdf' - - AssertLinter 'asdf', ale#Escape('asdf') . ' -f json' - -Execute(Overriding options should work): +Execute(Test tflint executable and command should be configurable): let g:ale_terraform_tflint_executable = 'fnord' let g:ale_terraform_tflint_options = '--whatever' diff --git a/test/linter/test_textlint.vader b/test/linter/test_textlint.vader index 6ec42b2d..4b1629d9 100644 --- a/test/linter/test_textlint.vader +++ b/test/linter/test_textlint.vader @@ -25,21 +25,16 @@ After: call ale#assert#TearDownLinterTest() -Execute(The default command should be correct): +Execute(The default textlint command should be correct): AssertLinter 'textlint', \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s' -Execute(The executable should be configurable): +Execute(The textlint executable and options should be configurable): let b:ale_textlint_executable = 'foobar' - - AssertLinter 'foobar', - \ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s' - -Execute(The options should be configurable): let b:ale_textlint_options = '--something' - AssertLinter 'textlint', - \ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s' + AssertLinter 'foobar', + \ ale#Escape('foobar') . ' --something -f json --stdin --stdin-filename %s' Execute(The local executable from .bin should be used if available): call ale#test#SetFilename('../test-files/textlint/with_bin_path/foo.txt') diff --git a/test/linter/test_thriftcheck.vader b/test/linter/test_thriftcheck.vader index 0da3bd6d..bf2bbab4 100644 --- a/test/linter/test_thriftcheck.vader +++ b/test/linter/test_thriftcheck.vader @@ -8,14 +8,9 @@ Execute(The default command should be correct): AssertLinter 'thriftcheck', ale#Escape('thriftcheck') \ . ' --stdin-filename %s %t' -Execute(The executable should be configurable): +Execute(The executable and options should be configurable): let b:ale_thrift_thriftcheck_executable = 'foobar' - - AssertLinter 'foobar', ale#Escape('foobar') - \ . ' --stdin-filename %s %t' - -Execute(The string of options should be configurable): let b:ale_thrift_thriftcheck_options = '--errors-only' - AssertLinter 'thriftcheck', ale#Escape('thriftcheck') + AssertLinter 'foobar', ale#Escape('foobar') \ . ' --errors-only --stdin-filename %s %t' diff --git a/test/linter/test_typescript_deno_lsp.vader b/test/linter/test_typescript_deno_lsp.vader index 944f6a0a..8bae1ae2 100644 --- a/test/linter/test_typescript_deno_lsp.vader +++ b/test/linter/test_typescript_deno_lsp.vader @@ -1,5 +1,10 @@ Before: - let g:ale_deno_importMap = 'import_map.json' + Save g:ale_deno_import_map + Save g:ale_deno_unstable + Save g:ale_deno_executable + Save g:ale_deno_lsp_project_root + + let g:ale_deno_import_map = 'import_map.json' let g:ale_deno_unstable = 0 let g:ale_deno_executable = 'deno' let g:ale_deno_lsp_project_root = '' @@ -50,7 +55,7 @@ Execute(Should set the importMap filepath from user defined importMap): \} Execute(Should set the importMap filepath from user defined importMap with unstable API): - let g:ale_deno_importMap = 'custom_import_map.json' + let g:ale_deno_import_map = 'custom_import_map.json' let g:ale_deno_unstable = 1 call ale#test#SetFilename('../test-files/typescript/test.ts') diff --git a/test/linter/test_v_command_callback.vader b/test/linter/test_v_command_callback.vader index 17f24ad7..7bffa958 100644 --- a/test/linter/test_v_command_callback.vader +++ b/test/linter/test_v_command_callback.vader @@ -1,25 +1,14 @@ Before: - Save g:ale_v_v_executable - call ale#assert#SetUpLinterTest('v', 'v') - GivenCommandOutput ['/foo/bar', '/foo/baz'] - After: - Restore call ale#assert#TearDownLinterTest() -Execute(The default command should be correct): - AssertLinter 'v', 'v . -o /tmp/vim-ale-v' - -Execute(Extra options should be supported): - let g:ale_v_v_options = '--foo-bar' +Execute(The default v command should be correct): + AssertLinter 'v', ale#Escape('v') . ' . -o /tmp/vim-ale-v' - AssertLinter 'v', 'v --foo-bar . -o /tmp/vim-ale-v' - - let g:ale_v_vbuild_options = '' - -Execute(The executable should be configurable): +Execute(The v executable and options should be configurable): let g:ale_v_v_executable = 'foobar' + let g:ale_v_v_options = '--foo-bar' - AssertLinter 'foobar', 'foobar . -o /tmp/vim-ale-v' + AssertLinter 'foobar', ale#Escape('foobar') . ' --foo-bar . -o /tmp/vim-ale-v' diff --git a/test/linter/test_vulture.vader b/test/linter/test_vulture.vader index 78655bd7..94e61158 100644 --- a/test/linter/test_vulture.vader +++ b/test/linter/test_vulture.vader @@ -56,6 +56,7 @@ Execute(Setting executable to 'pipenv' appends 'run vulture'): let g:ale_python_vulture_executable = 'path/to/pipenv' AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run vulture' . ' .' + Execute(Setting executable to 'poetry' appends 'run vulture'): let g:ale_python_vulture_executable = 'path/to/poetry' diff --git a/test/linter/test_xo.vader b/test/linter/test_xo.vader index 1aa4c3f1..a1e28836 100644 --- a/test/linter/test_xo.vader +++ b/test/linter/test_xo.vader @@ -9,15 +9,12 @@ Before: After: call ale#assert#TearDownLinterTest() -Execute(The XO executable should be called): +Execute(The default xo command should be correct): AssertLinter 'xo', ale#Escape('xo') . ' --reporter json --stdin --stdin-filename %s' -Execute(The XO executable should be configurable): +Execute(The xo executable and command should be configurable): let b:ale_javascript_xo_executable = 'foobar' - - AssertLinter 'foobar', ale#Escape('foobar') . ' --reporter json --stdin --stdin-filename %s' - -Execute(The XO options should be configurable): let b:ale_javascript_xo_options = '--wat' - AssertLinter 'xo', ale#Escape('xo') . ' --wat --reporter json --stdin --stdin-filename %s' + AssertLinter 'foobar', ale#Escape('foobar') + \ . ' --wat --reporter json --stdin --stdin-filename %s' diff --git a/test/linter/test_xvhdl.vader b/test/linter/test_xvhdl.vader index 86f9a32d..384e7e10 100644 --- a/test/linter/test_xvhdl.vader +++ b/test/linter/test_xvhdl.vader @@ -2,18 +2,13 @@ Before: call ale#assert#SetUpLinterTest('vhdl', 'xvhdl') After: - unlet! b:command_tail - call ale#assert#TearDownLinterTest() -Execute(The executable should be configurable): +Execute(The default xvhdl command should be correct): AssertLinter 'xvhdl', ale#Escape('xvhdl') . ' --2008 %t' +Execute(The xvhdl executable and options should be configurable): let b:ale_vhdl_xvhdl_executable = 'foobar' - - AssertLinter 'foobar', ale#Escape('foobar') . ' --2008 %t' - -Execute(The options should be configurable): let b:ale_vhdl_xvhdl_options = '--something' - AssertLinter 'xvhdl', ale#Escape('xvhdl') . ' --something %t' + AssertLinter 'foobar', ale#Escape('foobar') . ' --something %t' diff --git a/test/linter/test_xvlog.vader b/test/linter/test_xvlog.vader index 564ac979..56b5c4c2 100644 --- a/test/linter/test_xvlog.vader +++ b/test/linter/test_xvlog.vader @@ -2,8 +2,6 @@ Before: call ale#assert#SetUpLinterTest('verilog', 'xvlog') After: - unlet! b:command_tail - call ale#assert#TearDownLinterTest() Execute(The executable should be configurable): |