#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
This commit is contained in:
w0rp
2023-09-16 22:22:01 +01:00
parent 4b11cf21dc
commit ae1d051504
98 changed files with 257 additions and 674 deletions

View File

@@ -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')

View File

@@ -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

View File

@@ -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')

View File

@@ -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'

View File

@@ -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')

View File

@@ -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-*']

View File

@@ -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'

View File

@@ -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-*']

View File

@@ -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'

View File

@@ -68,4 +68,3 @@ Execute(Additional cspell options should be configurable):
\ 'cspell',
\ ale#Escape('cspell')
\ . ' lint --no-color --no-progress --no-summary --foobar -- stdin'

View File

@@ -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:

View File

@@ -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'

View File

@@ -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 (~)):
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 'foodcritic', ale#Escape('foodcritic') . ' -t \~F011 %s'
Execute(The executable should be configurable):
let b:ale_chef_foodcritic_executable = 'foobar'
AssertLinter 'foobar', ale#Escape('foobar') . ' %s'
AssertLinter 'foobar', ale#Escape('foobar') . ' -t \~F011 %s'

View File

@@ -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 -'

View File

@@ -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):
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 'go', 'go test --foo-bar -c -o /dev/null ./'
let g:ale_go_gobuild_options = ''
Execute(The executable should be configurable):
let g:ale_go_go_executable = 'foobar'
AssertLinter 'foobar', 'foobar test -c -o /dev/null ./'
AssertLinter 'foobar', ale#Escape('foobar')
\ . ' test --foo-bar -c -o /dev/null ./'

View File

@@ -12,21 +12,17 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The default command should be correct):
AssertLinter 'go', 'go vet .'
Execute(The default go vet command should be correct):
AssertLinter 'go', ale#Escape('go') . ' vet .'
AssertLinterCwd '%s:h'
Execute(Extra options should be supported):
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'
AssertLinterCwd '%s:h'
AssertLinter 'go', 'go vet --foo-bar .'
Execute(The executable should be configurable):
let g:ale_go_go_executable = 'foobar'
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 .'

View File

@@ -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'

View File

@@ -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

View File

@@ -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'

View File

@@ -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'] } }

View File

@@ -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')

View File

@@ -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'

View File

@@ -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

View File

@@ -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'

View File

@@ -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'

View File

@@ -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,
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'
Execute(The default nasm command should be correct):
AssertLinter 'nasm', ale#Escape('nasm')
\ . ' -X gnu -I %s:h' . (has('win32') ? '\' : '/')
\ . ' -w-macro-params %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
\ . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
Execute(The options should be used in command):
let b:ale_nasm_nasm_options = '-w+orphan-labels'
Execute(The nasm executable and options should be configurable):
let b:ale_nasm_nasm_executable = '~/nasm'
let b:ale_nasm_nasm_options = '-w-macro-params'
AssertLinter 'nasm', ale#Escape('nasm') . b:command_tail_opt
AssertLinter '~/nasm', ale#Escape('~/nasm')
\ . ' -X gnu -I %s:h' . (has('win32') ? '\' : '/')
\ . ' -w-macro-params'
\ . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null')

View File

@@ -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'

View File

@@ -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):

View File

@@ -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'

View File

@@ -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

View File

@@ -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')

View File

@@ -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')

View File

@@ -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'

View File

@@ -8,34 +8,29 @@ 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'
Execute(Should ignore non-absolute custom terraform executable):
AssertLinter 'foo', ale#Escape('foo') . ' serve --bar'
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'
Execute(Should return nearest directory with .terraform if found in parent directory):
call ale#test#SetFilename('../test-files/terraform/main.tf')

View File

@@ -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'

View File

@@ -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')

View File

@@ -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'

View File

@@ -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')

View File

@@ -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(The default v command should be correct):
AssertLinter 'v', ale#Escape('v') . ' . -o /tmp/vim-ale-v'
Execute(Extra options should be supported):
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 'v', 'v --foo-bar . -o /tmp/vim-ale-v'
let g:ale_v_vbuild_options = ''
Execute(The executable should be configurable):
let g:ale_v_v_executable = 'foobar'
AssertLinter 'foobar', 'foobar . -o /tmp/vim-ale-v'
AssertLinter 'foobar', ale#Escape('foobar') . ' --foo-bar . -o /tmp/vim-ale-v'

View File

@@ -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'

View File

@@ -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'

View File

@@ -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'

View File

@@ -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):