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 | |
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
98 files changed, 255 insertions, 672 deletions
diff --git a/ale_linters/go/gobuild.vim b/ale_linters/go/gobuild.vim index 5210c5a8..0342a230 100644 --- a/ale_linters/go/gobuild.vim +++ b/ale_linters/go/gobuild.vim @@ -6,16 +6,6 @@ call ale#Set('go_go_executable', 'go') call ale#Set('go_gobuild_options', '') -function! ale_linters#go#gobuild#GetCommand(buffer) abort - let l:options = ale#Var(a:buffer, 'go_gobuild_options') - - " Run go test in local directory with relative path - return ale#go#EnvString(a:buffer) - \ . ale#Var(a:buffer, 'go_go_executable') . ' test' - \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' -c -o /dev/null ./' -endfunction - function! ale_linters#go#gobuild#GetMatches(lines) abort " Matches patterns like the following: " @@ -50,7 +40,12 @@ call ale#linter#Define('go', { \ 'aliases': ['go build'], \ 'executable': {b -> ale#Var(b, 'go_go_executable')}, \ 'cwd': '%s:h', -\ 'command': function('ale_linters#go#gobuild#GetCommand'), +\ 'command': {b -> +\ ale#go#EnvString(b) +\ . ale#Escape(ale#Var(b, 'go_go_executable')) . ' test' +\ . ale#Pad(ale#Var(b, 'go_gobuild_options')) +\ . ' -c -o /dev/null ./' +\ }, \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#go#gobuild#Handler', \ 'lint_file': 1, diff --git a/ale_linters/go/govet.vim b/ale_linters/go/govet.vim index 5da8261c..414c8b11 100644 --- a/ale_linters/go/govet.vim +++ b/ale_linters/go/govet.vim @@ -1,28 +1,21 @@ -" Author: neersighted <bjorn@neersighted.com> +" Author: neersighted <bjorn@neersighted.com>, John Eikenberry <jae@zhar.net> " Description: go vet for Go files -" -" Author: John Eikenberry <jae@zhar.net> -" Description: updated to work with go1.10 call ale#Set('go_go_executable', 'go') call ale#Set('go_govet_options', '') -function! ale_linters#go#govet#GetCommand(buffer) abort - let l:options = ale#Var(a:buffer, 'go_govet_options') - - return ale#go#EnvString(a:buffer) - \ . ale#Var(a:buffer, 'go_go_executable') . ' vet ' - \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' .' -endfunction - call ale#linter#Define('go', { \ 'name': 'govet', \ 'aliases': ['go vet'], \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'go_go_executable')}, \ 'cwd': '%s:h', -\ 'command': function('ale_linters#go#govet#GetCommand'), +\ 'command': {b -> +\ ale#go#EnvString(b) +\ . '%e vet' +\ . ale#Pad(ale#Var(b, 'go_govet_options')) +\ . ' .' +\ }, \ 'callback': 'ale#handlers#go#Handler', \ 'lint_file': 1, \}) diff --git a/ale_linters/handlebars/embertemplatelint.vim b/ale_linters/handlebars/embertemplatelint.vim index 17c4d08e..14fa3b2e 100644 --- a/ale_linters/handlebars/embertemplatelint.vim +++ b/ale_linters/handlebars/embertemplatelint.vim @@ -16,12 +16,7 @@ function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) a return '%e --format=json --filename %s' endif - if ale#semver#GTE(a:version, [1, 6, 0]) - " Reading from stdin was introduced in ember-template-lint@1.6.0 - return '%e --json --filename %s' - endif - - return '%e --json %t' + return '%e --json --filename %s' endfunction function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort diff --git a/ale_linters/v/v.vim b/ale_linters/v/v.vim index afa98c56..dfe6f562 100644 --- a/ale_linters/v/v.vim +++ b/ale_linters/v/v.vim @@ -4,17 +4,6 @@ call ale#Set('v_v_executable', 'v') call ale#Set('v_v_options', '') -function! ale_linters#v#v#GetCommand(buffer) abort - let l:options = ale#Var(a:buffer, 'v_v_options') - - " Run v in local directory with relative path - let l:command = ale#Var(a:buffer, 'v_v_executable') - \ . ale#Pad(l:options) - \ . ' .' . ' -o /tmp/vim-ale-v' - - return l:command -endfunction - function! ale_linters#v#v#Handler(buffer, lines) abort let l:dir = expand('#' . a:buffer . ':p:h') let l:output = [] @@ -73,9 +62,11 @@ endfunction call ale#linter#Define('v', { \ 'name': 'v', -\ 'aliases': [], \ 'executable': {b -> ale#Var(b, 'v_v_executable')}, -\ 'command': function('ale_linters#v#v#GetCommand'), +\ 'command': {b -> +\ '%e' . ale#Pad(ale#Var(b, 'v_v_options')) +\ . ' . -o /tmp/vim-ale-v' +\ }, \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#v#v#Handler', \ 'lint_file': 1, diff --git a/autoload/ale/handlers/deno.vim b/autoload/ale/handlers/deno.vim index b762f983..1770559d 100644 --- a/autoload/ale/handlers/deno.vim +++ b/autoload/ale/handlers/deno.vim @@ -4,7 +4,7 @@ call ale#Set('deno_executable', 'deno') call ale#Set('deno_unstable', 0) -call ale#Set('deno_importMap', 'import_map.json') +call ale#Set('deno_import_map', 'import_map.json') call ale#Set('deno_lsp_project_root', '') function! ale#handlers#deno#GetExecutable(buffer) abort @@ -68,8 +68,19 @@ function! ale#handlers#deno#GetInitializationOptions(buffer) abort let l:options.unstable = v:true endif - if ale#Var(a:buffer, 'deno_importMap') isnot# '' - let l:options.importMap = ale#path#FindNearestFile(a:buffer, ale#Var(a:buffer, 'deno_importMap')) + " Look for a value set using the historical option name. + let l:import_map = getbufvar( + \ a:buffer, + \ 'ale_deno_importMap', + \ get(g:, 'ale_deno_importMap', '') + \) + + if empty(l:import_map) + let l:import_map = ale#Var(a:buffer, 'deno_import_map') + endif + + if !empty(l:import_map) + let l:options.importMap = ale#path#FindNearestFile(a:buffer, l:import_map) endif return l:options diff --git a/doc/ale-typescript.txt b/doc/ale-typescript.txt index 4a993793..ab3f17bd 100644 --- a/doc/ale-typescript.txt +++ b/doc/ale-typescript.txt @@ -42,8 +42,8 @@ g:ale_deno_unstable *g:ale_deno_unstable* Enable or disable unstable Deno features and APIs. -g:ale_deno_importMap *g:ale_deno_importMap* - *b:ale_deno_importMap* +g:ale_deno_import_map *g:ale_deno_import_map* + *b:ale_deno_import_map* Type: |String| Default: `'import_map.json'` diff --git a/test/handler/test_ansible_lint_handler.vader b/test/handler/test_ansible_lint_handler.vader index 92e11332..e0c67ab8 100644 --- a/test/handler/test_ansible_lint_handler.vader +++ b/test/handler/test_ansible_lint_handler.vader @@ -1,11 +1,14 @@ Before: + Save b:ale_warn_about_trailing_whitespace + runtime ale_linters/ansible/ansible_lint.vim call ale#test#SetFilename('test_playbook.yml') let b:ale_warn_about_trailing_whitespace = 1 After: - unlet! b:ale_warn_about_trailing_whitespace + Restore + call ale#linter#Reset() Execute(The ansible-lint handler for version group <5 should handle basic errors): diff --git a/test/handler/test_asm_handler.vader b/test/handler/test_asm_handler.vader index 4ab99992..e28b7ae8 100644 --- a/test/handler/test_asm_handler.vader +++ b/test/handler/test_asm_handler.vader @@ -5,7 +5,6 @@ After: call ale#linter#Reset() Execute(The asm GCC handler should parse lines from GCC 6.3.1 correctly): - AssertEqual \ [ \ { diff --git a/test/handler/test_bibclean_handler.vader b/test/handler/test_bibclean_handler.vader index 9da52a92..5735065b 100644 --- a/test/handler/test_bibclean_handler.vader +++ b/test/handler/test_bibclean_handler.vader @@ -5,7 +5,6 @@ After: call ale#linter#Reset() Execute(The bibclean handler should parse lines from bibclean <= v2.11.4 correctly): - AssertEqual \ [ \ { @@ -46,7 +45,6 @@ Execute(The bibclean handler should parse lines from bibclean <= v2.11.4 correct \ ]) Execute(The bibclean handler should parse lines of bibclean > v2.11.4 correctly): - AssertEqual \ [ \ { diff --git a/test/handler/test_bicep_az_bicep_handler.vader b/test/handler/test_bicep_az_bicep_handler.vader index 5205b83b..01dbe433 100644 --- a/test/handler/test_bicep_az_bicep_handler.vader +++ b/test/handler/test_bicep_az_bicep_handler.vader @@ -2,8 +2,6 @@ Before: runtime ale_linters/bicep/az_bicep.vim After: - Restore - call ale#linter#Reset() Execute(The az_bicep handler should handle basic warnings): diff --git a/test/handler/test_bicep_bicep_handler.vader b/test/handler/test_bicep_bicep_handler.vader index b91c2551..82f02737 100644 --- a/test/handler/test_bicep_bicep_handler.vader +++ b/test/handler/test_bicep_bicep_handler.vader @@ -2,8 +2,6 @@ Before: runtime ale_linters/bicep/bicep.vim After: - Restore - call ale#linter#Reset() Execute(The bicep handler should handle basic warnings): diff --git a/test/handler/test_brakeman_handler.vader b/test/handler/test_brakeman_handler.vader index ad5376f7..3a17ec71 100644 --- a/test/handler/test_brakeman_handler.vader +++ b/test/handler/test_brakeman_handler.vader @@ -74,7 +74,7 @@ Execute(The brakeman handler should parse JSON correctly when there is no output \ [], \ ale_linters#ruby#brakeman#Handle(347, [ \ ]) - \ + Execute(The brakeman handler should handle garbage output): AssertEqual \ [], diff --git a/test/handler/test_checkmake_handler.vader b/test/handler/test_checkmake_handler.vader index f1efb23e..bd1a67f8 100644 --- a/test/handler/test_checkmake_handler.vader +++ b/test/handler/test_checkmake_handler.vader @@ -2,11 +2,9 @@ Before: runtime ale_linters/make/checkmake.vim After: - call ale#linter#Reset() + call ale#linter#Reset() Execute(Parsing checkmake errors should work): - silent file Makefile - AssertEqual \ [ \ { diff --git a/test/handler/test_cmake_lint_handler.vader b/test/handler/test_cmake_lint_handler.vader index 26fb8c1d..31c49c21 100644 --- a/test/handler/test_cmake_lint_handler.vader +++ b/test/handler/test_cmake_lint_handler.vader @@ -2,8 +2,6 @@ Before: runtime ale_linters/cmake/cmake_lint.vim After: - Restore - call ale#linter#Reset() Execute(The cmake_lint handler should handle basic warnings): diff --git a/test/handler/test_cookstyle_handler.vader b/test/handler/test_cookstyle_handler.vader index 7d705a19..761fc019 100644 --- a/test/handler/test_cookstyle_handler.vader +++ b/test/handler/test_cookstyle_handler.vader @@ -19,4 +19,3 @@ Execute(Basic warnings should be handled): \ ale_linters#chef#cookstyle#Handle(bufnr(''), [ \ '{"metadata":{"rubocop_version":"0.62.0","ruby_engine":"ruby","ruby_version":"2.6.0","ruby_patchlevel":"0","ruby_platform":"x86_64-linux"},"files":[{"path":"recipes/default.rb","offenses":[{"severity":"convention","message":"Style/UnneededInterpolation: Prefer `to_s` over string interpolation.","cop_name":"Style/UnneededInterpolation","corrected":false,"location":{"start_line":58,"start_column":24,"last_line":58,"last_column":40,"length":17,"line":58,"column":24}}]}],"summary":{"offense_count":1,"target_file_count":1,"inspected_file_count":1}}' \ ]) - diff --git a/test/handler/test_cpplint_handler.vader b/test/handler/test_cpplint_handler.vader index d8d7b8b7..42518a53 100644 --- a/test/handler/test_cpplint_handler.vader +++ b/test/handler/test_cpplint_handler.vader @@ -5,7 +5,6 @@ After: call ale#linter#Reset() Execute(cpplint warnings from included files should be parsed correctly): - AssertEqual \ [ \ { diff --git a/test/handler/test_csc_handler.vader b/test/handler/test_csc_handler.vader index 3db5b6fd..c5c0a47e 100644 --- a/test/handler/test_csc_handler.vader +++ b/test/handler/test_csc_handler.vader @@ -9,7 +9,7 @@ Before: runtime ale_linters/cs/csc.vim After: - unlet! g:ale_cs_csc_source + Restore call ale#test#RestoreDirectory() call ale#linter#Reset() diff --git a/test/handler/test_deadnix_handler.vader b/test/handler/test_deadnix_handler.vader index 242af881..508ce0f9 100644 --- a/test/handler/test_deadnix_handler.vader +++ b/test/handler/test_deadnix_handler.vader @@ -1,8 +1,4 @@ Execute(The deadnix handler should handle deadnix output): - let output = [ - \'{"file":"./flake.nix","results":[{"column":5,"endColumn":9,"line":23,"message":"Unused lambda pattern: self"},{"column":2,"endColumn":6,"line":1,"message":"Unused lambda pattern: pkgs"}]}' - \] - AssertEqual \ [ \ { @@ -20,7 +16,9 @@ Execute(The deadnix handler should handle deadnix output): \ 'type': 'W', \ }, \ ], - \ ale#handlers#deadnix#Handle(bufnr(''), output) + \ ale#handlers#deadnix#Handle(bufnr(''), [ + \ '{"file":"./flake.nix","results":[{"column":5,"endColumn":9,"line":23,"message":"Unused lambda pattern: self"},{"column":2,"endColumn":6,"line":1,"message":"Unused lambda pattern: pkgs"}]}' + \ ]) AssertEqual [], ale#handlers#deadnix#Handle(bufnr(''), ['']) AssertEqual [], ale#handlers#deadnix#Handle(bufnr(''), ['not json']) diff --git a/test/handler/test_dogma_handler.vader b/test/handler/test_dogma_handler.vader index ead6d09f..ad8aec94 100644 --- a/test/handler/test_dogma_handler.vader +++ b/test/handler/test_dogma_handler.vader @@ -5,7 +5,6 @@ After: call ale#linter#Reset() Execute(The dogma handler should parse lines correctly): - AssertEqual \ [ \ { diff --git a/test/handler/test_erblint_handler.vader b/test/handler/test_erblint_handler.vader index 01d4c0ab..03836713 100644 --- a/test/handler/test_erblint_handler.vader +++ b/test/handler/test_erblint_handler.vader @@ -2,7 +2,6 @@ Before: runtime ale_linters/eruby/erblint.vim After: - unlet! g:lines call ale#linter#Reset() Execute(The erblint handler should parse lines correctly): @@ -61,10 +60,5 @@ Execute(The erblint handler should handle when files are checked and no offenses \ ]) Execute(The erblint handler should handle output without any errors): - AssertEqual - \ [], - \ ale_linters#eruby#erblint#Handle(347, ['{}']) - - AssertEqual - \ [], - \ ale_linters#eruby#erblint#Handle(347, []) + AssertEqual [], ale_linters#eruby#erblint#Handle(347, ['{}']) + AssertEqual [], ale_linters#eruby#erblint#Handle(347, []) diff --git a/test/handler/test_erlang_dialyzer_handler.vader b/test/handler/test_erlang_dialyzer_handler.vader index afd5c597..aa5c2305 100644 --- a/test/handler/test_erlang_dialyzer_handler.vader +++ b/test/handler/test_erlang_dialyzer_handler.vader @@ -16,12 +16,6 @@ Execute(The dialyzer handler should handle error messages.): \], \ ale_linters#erlang#dialyzer#Handle(bufnr(''), ['erl_tidy_prv_fmt.erl:3: Callback info about the provider behaviour is not available']) -Execute(The dialyzer handler should handle empty file.): - AssertEqual - \[], - \ ale_linters#erlang#dialyzer#Handle(bufnr(''), []) - -Execute(The dialyzer handler should handle empty lines.): - AssertEqual - \[], - \ ale_linters#erlang#dialyzer#Handle(bufnr(''), ['']) +Execute(The dialyzer handler should handle empty input): + AssertEqual [], ale_linters#erlang#dialyzer#Handle(bufnr(''), []) + AssertEqual [], ale_linters#erlang#dialyzer#Handle(bufnr(''), ['']) diff --git a/test/handler/test_fish_handler.vader b/test/handler/test_fish_handler.vader index ad3a963c..25942abb 100644 --- a/test/handler/test_fish_handler.vader +++ b/test/handler/test_fish_handler.vader @@ -1,8 +1,8 @@ Before: - runtime ale_linters/fish/fish.vim + runtime ale_linters/fish/fish.vim After: - call ale#linter#Reset() + call ale#linter#Reset() Execute(The fish handler should handle basic warnings and syntax errors): AssertEqual diff --git a/test/handler/test_flawfinder_handler.vader b/test/handler/test_flawfinder_handler.vader index 708bac2a..01dd1698 100644 --- a/test/handler/test_flawfinder_handler.vader +++ b/test/handler/test_flawfinder_handler.vader @@ -1,23 +1,10 @@ Before: - Save g:ale_c_flawfinder_error_severity - - unlet! g:ale_c_flawfinder_error_severity - unlet! b:ale_c_flawfinder_error_severity - + Save b:ale_c_flawfinder_error_severity runtime ale_linters/c/flawfinder.vim After: - unlet! g:ale_c_flawfinder_error_severity Restore - -Execute(The Flawfinder handler should ignore other lines of output): - AssertEqual - \ [], - \ ale#handlers#flawfinder#HandleFlawfinderFormat(347, [ - \ 'foo', - \ 'bar', - \ 'baz', - \ ]) + call ale#linter#Reset() Execute(The Flawfinder handler should work): AssertEqual @@ -30,7 +17,10 @@ Execute(The Flawfinder handler should work): \ }, \ ], \ ale#handlers#flawfinder#HandleFlawfinderFormat(347, [ - \ "<stdin>:31:4: [1] (buffer) strncpy:Easily used incorrectly", + \ '<stdin>:31:4: [1] (buffer) strncpy:Easily used incorrectly', + \ 'foo', + \ 'bar', + \ 'baz', \ ]) Execute(The Flawfinder error severity level should be configurable): @@ -52,6 +42,6 @@ Execute(The Flawfinder error severity level should be configurable): \ }, \ ], \ ale#handlers#flawfinder#HandleFlawfinderFormat(bufnr(''), [ - \ "<stdin>:12:4: [2] (buffer) char:Statically-sized arrays can be bad", - \ "<stdin>:31:4: [1] (buffer) strncpy:Easily used incorrectly", + \ '<stdin>:12:4: [2] (buffer) char:Statically-sized arrays can be bad', + \ '<stdin>:31:4: [1] (buffer) strncpy:Easily used incorrectly', \ ]) diff --git a/test/handler/test_fortran_handler.vader b/test/handler/test_fortran_handler.vader index c55a4c6f..50ed5a18 100644 --- a/test/handler/test_fortran_handler.vader +++ b/test/handler/test_fortran_handler.vader @@ -4,69 +4,6 @@ Before: After: call ale#linter#Reset() -Execute(The fortran handler should parse lines from GCC 4.1.2 correctly): - AssertEqual - \ [ - \ { - \ 'bufnr': 357, - \ 'lnum': 4, - \ 'col': 0, - \ 'text': "Symbol ‘b’ at (1) has no IMPLICIT type", - \ 'type': 'E', - \ }, - \ { - \ 'bufnr': 357, - \ 'lnum': 3, - \ 'col': 0, - \ 'text': "Symbol ‘a’ at (1) has no IMPLICIT type", - \ 'type': 'E', - \ }, - \ ], - \ ale_linters#fortran#gcc#Handle(357, [ - \ " In file :4", - \ "", - \ "write(*,*) b", - \ " 1", - \ "Error: Symbol ‘b’ at (1) has no IMPLICIT type", - \ " In file :3", - \ "", - \ "write(*,*) a", - \ " 1", - \ "Error: Symbol ‘a’ at (1) has no IMPLICIT type", - \ ]) - - -Execute(The fortran handler should parse lines from GCC 4.9.3 correctly): - AssertEqual - \ [ - \ { - \ 'bufnr': 357, - \ 'lnum': 3, - \ 'col': 12, - \ 'text': "Symbol ‘a’ at (1) has no IMPLICIT type", - \ 'type': 'E', - \ }, - \ { - \ 'bufnr': 357, - \ 'lnum': 4, - \ 'col': 12, - \ 'text': "Symbol ‘b’ at (1) has no IMPLICIT type", - \ 'type': 'E', - \ }, - \ ], - \ ale_linters#fortran#gcc#Handle(357, [ - \ ":3.12:", - \ "", - \ "write(*,*) a", - \ " 1", - \ "Error: Symbol ‘a’ at (1) has no IMPLICIT type", - \ ":4.12:", - \ "", - \ "write(*,*) b", - \ " 1", - \ "Error: Symbol ‘b’ at (1) has no IMPLICIT type", - \ ]) - Execute(The fortran handler should parse lines from GCC 6.3.1 correctly): AssertEqual \ [ diff --git a/test/handler/test_gawk_handler.vader b/test/handler/test_gawk_handler.vader index 3a7b5457..52d01da8 100644 --- a/test/handler/test_gawk_handler.vader +++ b/test/handler/test_gawk_handler.vader @@ -5,7 +5,6 @@ After: call ale#linter#Reset() Execute(gawk syntax errors should be parsed correctly): - AssertEqual \ [ \ { diff --git a/test/handler/test_gcc_handler.vader b/test/handler/test_gcc_handler.vader index a4231cab..e95734bd 100644 --- a/test/handler/test_gcc_handler.vader +++ b/test/handler/test_gcc_handler.vader @@ -1,11 +1,7 @@ Execute(The GCC handler should ignore other lines of output): AssertEqual \ [], - \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ - \ 'foo', - \ 'bar', - \ 'baz', - \ ]) + \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, ['foo', 'bar', 'baz']) Execute(GCC errors from included files should be parsed correctly): AssertEqual diff --git a/test/handler/test_ghc_handler.vader b/test/handler/test_ghc_handler.vader index feaa51fc..73cd725f 100644 --- a/test/handler/test_ghc_handler.vader +++ b/test/handler/test_ghc_handler.vader @@ -1,3 +1,6 @@ +After: + unlet! g:detail + Execute(The ghc handler should handle hdevtools output): call ale#test#SetFilename('foo.hs') diff --git a/test/handler/test_gitlablint_handler.vader b/test/handler/test_gitlablint_handler.vader index 3b08ccb4..d61766bd 100644 --- a/test/handler/test_gitlablint_handler.vader +++ b/test/handler/test_gitlablint_handler.vader @@ -2,7 +2,6 @@ Before: runtime! ale_linters/yaml/gitlablint.vim After: - Restore call ale#linter#Reset() Execute(Problems should be parsed correctly for gitlablint): diff --git a/test/handler/test_golangci_lint_handler.vader b/test/handler/test_golangci_lint_handler.vader index 7bb6b877..a08234b5 100644 --- a/test/handler/test_golangci_lint_handler.vader +++ b/test/handler/test_golangci_lint_handler.vader @@ -43,8 +43,6 @@ Execute (The golangci-lint handler should handle paths correctly): Execute (The golangci-lint handler should handle only typecheck lines as errors): call ale#test#SetFilename('app/main.go') - let file = ale#path#GetAbsPath(expand('%:p:h'), 'test.go') - AssertEqual \ [ \ { @@ -63,6 +61,6 @@ Execute (The golangci-lint handler should handle only typecheck lines as errors) \ } \ ], \ ale_linters#go#golangci_lint#Handler(bufnr(''), [ - \ file . ':30:5: variable ''err'' is not used (typecheck)', - \ file . ':505:75: Magic number: 404, in <argument> detected (gomnd)', + \ ale#path#GetAbsPath(expand('%:p:h'), 'test.go') . ':30:5: variable ''err'' is not used (typecheck)', + \ ale#path#GetAbsPath(expand('%:p:h'), 'test.go') . ':505:75: Magic number: 404, in <argument> detected (gomnd)', \ ]) diff --git a/test/handler/test_llvm_mc_handler.vader b/test/handler/test_llvm_mc_handler.vader index e38ca304..990de525 100644 --- a/test/handler/test_llvm_mc_handler.vader +++ b/test/handler/test_llvm_mc_handler.vader @@ -5,7 +5,6 @@ After: call ale#linter#Reset() Execute(The asm llvm-mc handler should parse lines correctly): - AssertEqual \ [ \ { diff --git a/test/handler/test_luac_handler.vader b/test/handler/test_luac_handler.vader index 3a2e769c..6bb51c34 100644 --- a/test/handler/test_luac_handler.vader +++ b/test/handler/test_luac_handler.vader @@ -33,4 +33,3 @@ Execute(The luac handler should parse lines correctly): \ 'luac /file/path/here.lua:3: unexpected symbol near ''-''', \ 'luac /file/path/here.lua:5: ''='' expected near '')''', \ ]) - diff --git a/test/handler/test_markdownlint_handler.vader b/test/handler/test_markdownlint_handler.vader index f2e6e328..f49dba97 100644 --- a/test/handler/test_markdownlint_handler.vader +++ b/test/handler/test_markdownlint_handler.vader @@ -4,64 +4,7 @@ Before: After: call ale#linter#Reset() -Execute(The Markdownlint handler should parse pre v0.19.0 output with single digit line correctly): - AssertEqual - \ [ - \ { - \ 'lnum': 1, - \ 'code': 'MD013/line-length', - \ 'text': 'Line length [Expected: 80; Actual: 114]', - \ 'type': 'W' - \ } - \ ], - \ ale#handlers#markdownlint#Handle(0, [ - \ 'README.md: 1: MD013/line-length Line length [Expected: 80; Actual: 114]' - \ ]) - -Execute(The Markdownlint handler should parse pre v0.19.0 output with multi digit line correctly): - AssertEqual - \ [ - \ { - \ 'lnum': 100, - \ 'code': 'MD013/line-length', - \ 'text': 'Line length [Expected: 80; Actual: 114]', - \ 'type': 'W' - \ } - \ ], - \ ale#handlers#markdownlint#Handle(0, [ - \ 'README.md: 100: MD013/line-length Line length [Expected: 80; Actual: 114]' - \ ]) - -Execute(The Markdownlint handler should parse post v0.19.0 output with single digit line correctly): - AssertEqual - \ [ - \ { - \ 'lnum': 1, - \ 'code': 'MD013/line-length', - \ 'text': 'Line length [Expected: 80; Actual: 114]', - \ 'type': 'W' - \ } - \ ], - \ ale#handlers#markdownlint#Handle(0, [ - \ 'README.md:1 MD013/line-length Line length [Expected: 80; Actual: 114]' - \ ]) - -Execute(The Markdownlint handler should parse post v0.19.0 output with multi digit line correctly): - AssertEqual - \ [ - \ { - \ 'lnum': 100, - \ 'code': 'MD013/line-length', - \ 'text': 'Line length [Expected: 80; Actual: 114]', - \ 'type': 'W' - \ } - \ ], - \ ale#handlers#markdownlint#Handle(0, [ - \ 'README.md:100 MD013/line-length Line length [Expected: 80; Actual: 114]' - \ ]) - - -Execute(The Markdownlint handler should parse post v0.22.0 output with column correctly): +Execute(The Markdownlint handler should parse output with a column correctly): AssertEqual \ [ \ { diff --git a/test/handler/test_mix_handler.vader b/test/handler/test_mix_handler.vader index a5549b5d..fc04f8f7 100644 --- a/test/handler/test_mix_handler.vader +++ b/test/handler/test_mix_handler.vader @@ -5,7 +5,6 @@ After: call ale#linter#Reset() Execute(The mix handler should parse lines correctly): - AssertEqual \ [ \ { diff --git a/test/handler/test_perlcritic_handler.vader b/test/handler/test_perlcritic_handler.vader index f00b07da..f165a32f 100644 --- a/test/handler/test_perlcritic_handler.vader +++ b/test/handler/test_perlcritic_handler.vader @@ -17,4 +17,3 @@ Execute(The Perl::Critic handler should create all issues as warnings): \ ale_linters#perl#perlcritic#Handle(99, [ \ '21:17 Regular expression without "/m" flag' \ ]) - diff --git a/test/handler/test_phpstan_handler.vader b/test/handler/test_phpstan_handler.vader index 58cb574f..3599178f 100644 --- a/test/handler/test_phpstan_handler.vader +++ b/test/handler/test_phpstan_handler.vader @@ -4,8 +4,6 @@ Before: runtime ale_linters/php/phpstan.vim After: - Restore - call ale#test#RestoreDirectory() call ale#linter#Reset() diff --git a/test/handler/test_prospector_handler.vader b/test/handler/test_prospector_handler.vader index 935c37da..2e9a9918 100644 --- a/test/handler/test_prospector_handler.vader +++ b/test/handler/test_prospector_handler.vader @@ -10,8 +10,6 @@ After: call ale#linter#Reset() - silent file something_else.py - Execute(Basic prospector errors should be handle): AssertEqual \ [ diff --git a/test/handler/test_pycodestyle_handler.vader b/test/handler/test_pycodestyle_handler.vader index 3664455e..a2efde23 100644 --- a/test/handler/test_pycodestyle_handler.vader +++ b/test/handler/test_pycodestyle_handler.vader @@ -14,7 +14,6 @@ After: unlet! b:ale_warn_about_trailing_whitespace call ale#linter#Reset() - silent file something_else.py Execute(The pycodestyle handler should parse output): AssertEqual diff --git a/test/handler/test_pydocstyle_handler.vader b/test/handler/test_pydocstyle_handler.vader index cfb75307..ec5ff9da 100644 --- a/test/handler/test_pydocstyle_handler.vader +++ b/test/handler/test_pydocstyle_handler.vader @@ -20,7 +20,7 @@ After: " This is a multi-line description that should produce multiple errors to be " tested by the handler " """ -" return Fales +" return False " " " if __name__ == '__main__': diff --git a/test/handler/test_reek_handler.vader b/test/handler/test_reek_handler.vader index db0a1119..98c2b736 100644 --- a/test/handler/test_reek_handler.vader +++ b/test/handler/test_reek_handler.vader @@ -1,12 +1,19 @@ Before: + Save g:ale_ruby_reek_show_context + Save g:ale_ruby_reek_show_wiki_link + + let g:ale_ruby_reek_show_context = 0 + let g:ale_ruby_reek_show_wiki_link = 0 + runtime ale_linters/ruby/reek.vim After: + Restore + call ale#linter#Reset() Execute(The reek handler should parse JSON correctly, with only context enabled): let g:ale_ruby_reek_show_context = 1 - let g:ale_ruby_reek_show_wiki_link = 0 AssertEqual \ [ @@ -34,9 +41,6 @@ Execute(The reek handler should parse JSON correctly, with only context enabled) \ ]) Execute(The reek handler should parse JSON correctly, with no context or wiki links): - let g:ale_ruby_reek_show_context = 0 - let g:ale_ruby_reek_show_wiki_link = 0 - AssertEqual \ [ \ { diff --git a/test/handler/test_rflint_handler.vader b/test/handler/test_rflint_handler.vader index f2670141..8fc6296c 100644 --- a/test/handler/test_rflint_handler.vader +++ b/test/handler/test_rflint_handler.vader @@ -30,4 +30,3 @@ Execute(Warning and error messages should be handled correctly): \ 'test.robot:W:1:2:RequireSuiteDocumentation:No suite documentation', \ 'test.robot:E:3:4:RequireTestDocumentation:No testcase documentation' \]) - diff --git a/test/handler/test_rubocop_handler.vader b/test/handler/test_rubocop_handler.vader index d7868f26..a7db471e 100644 --- a/test/handler/test_rubocop_handler.vader +++ b/test/handler/test_rubocop_handler.vader @@ -2,7 +2,6 @@ Before: runtime ale_linters/ruby/rubocop.vim After: - unlet! g:lines call ale#linter#Reset() Execute(The rubocop handler should parse lines correctly): @@ -59,18 +58,6 @@ Execute(The rubocop handler should handle when no files are checked): \ '{"metadata":{"rubocop_version":"0.47.1","ruby_engine":"ruby","ruby_version":"2.1.5","ruby_patchlevel":"273","ruby_platform":"x86_64-linux-gnu"},"files":[],"summary":{"offense_count":0,"target_file_count":0,"inspected_file_count":0}}' \ ]) -Execute(The rubocop handler should handle output without any errors): - let g:lines = [ - \ '{"metadata":{"rubocop_version":"0.48.1","ruby_engine":"ruby","ruby_version":"2.4.1","ruby_patchlevel":"111","ruby_platform":"x86_64-darwin16"},"files":[]}', - \] - - AssertEqual - \ [], - \ ale#ruby#HandleRubocopOutput(347, g:lines) - \ - AssertEqual - \ [], - \ ale#ruby#HandleRubocopOutput(347, ['{}']) - AssertEqual - \ [], - \ ale#ruby#HandleRubocopOutput(347, []) +Execute(The rubocop handler should handle empty output): + AssertEqual [], ale#ruby#HandleRubocopOutput(347, ['{}']) + AssertEqual [], ale#ruby#HandleRubocopOutput(347, []) diff --git a/test/handler/test_rust_handler.vader b/test/handler/test_rust_handler.vader index 845df2b5..bbd12f3e 100644 --- a/test/handler/test_rust_handler.vader +++ b/test/handler/test_rust_handler.vader @@ -1,3 +1,11 @@ +Before: + Save g:ale_rust_ignore_secondary_spans + + let g:ale_rust_ignore_secondary_spans = 0 + +After: + Restore + Execute(The Rust handler should handle rustc output): call ale#test#SetFilename('src/playpen.rs') @@ -340,7 +348,6 @@ Execute(The Rust handler should find correct files): Execute(The Rust handler should remove secondary spans if set): call ale#test#SetFilename('src/noerrors/mod.rs') - let g:ale_rust_ignore_secondary_spans = 0 AssertEqual \ [ \ { @@ -416,6 +423,7 @@ Execute(The Rust handler should remove secondary spans if set): \ ]) let g:ale_rust_ignore_secondary_spans = 1 + AssertEqual \ [ \ { diff --git a/test/handler/test_scala_handler.vader b/test/handler/test_scala_handler.vader index 3214bdbc..d983d84a 100644 --- a/test/handler/test_scala_handler.vader +++ b/test/handler/test_scala_handler.vader @@ -1,13 +1,10 @@ -After: - call ale#linter#Reset() - Execute(The handler should return an empty list with empty input): AssertEqual [], ale#handlers#scala#HandleScalacLintFormat(bufnr(''), []) Execute(The handler should correctly parse error messages): - AssertEqual + AssertEqual \ [ - \ { + \ { \ 'lnum': 4, \ 'col': 8, \ 'text': ''':'' expected but identifier found.', diff --git a/test/handler/test_slim_handler.vader b/test/handler/test_slim_handler.vader index bfd29f3a..d16082e0 100644 --- a/test/handler/test_slim_handler.vader +++ b/test/handler/test_slim_handler.vader @@ -6,7 +6,6 @@ After: call ale#linter#Reset() Execute(The slim handler should parse lines correctly): - AssertEqual \ [ \ { diff --git a/test/handler/test_sql_sqlfluff_handler.vader b/test/handler/test_sql_sqlfluff_handler.vader index f1f684bd..1f0e028a 100644 --- a/test/handler/test_sql_sqlfluff_handler.vader +++ b/test/handler/test_sql_sqlfluff_handler.vader @@ -2,8 +2,6 @@ Before: runtime ale_linters/sql/sqlfluff.vim After: - Restore - call ale#linter#Reset() Execute(The sqlfluff handler should handle basic warnings): diff --git a/test/handler/test_textlint_handler.vader b/test/handler/test_textlint_handler.vader index c00d54de..b6d73648 100644 --- a/test/handler/test_textlint_handler.vader +++ b/test/handler/test_textlint_handler.vader @@ -37,5 +37,4 @@ Execute(textlint handler should handle errors output): Execute(textlint handler should no error output): AssertEqual \ [], - \ ale#handlers#textlint#HandleTextlintOutput(bufnr(''), [ - \ ]) + \ ale#handlers#textlint#HandleTextlintOutput(bufnr(''), []) diff --git a/test/handler/test_tflint_handler.vader b/test/handler/test_tflint_handler.vader index 6b8173af..dfff85ac 100644 --- a/test/handler/test_tflint_handler.vader +++ b/test/handler/test_tflint_handler.vader @@ -4,32 +4,6 @@ Before: After: call ale#linter#Reset() -Execute(The tflint handler should parse items correctly for pre 0.11): - AssertEqual - \ [ - \ { - \ 'lnum': 12, - \ 'text': 'be warned, traveller', - \ 'code': 'aws_db_instance_readable_password', - \ 'type': 'W', - \ }, - \ { - \ 'lnum': 9, - \ 'text': 'error message', - \ 'code': 'aws_elasticache_cluster_invalid_type', - \ 'type': 'E', - \ }, - \ { - \ 'lnum': 5, - \ 'text': 'just so ya know', - \ 'code': 'aws_instance_not_specified_iam_profile', - \ 'type': 'I', - \ }, - \ ], - \ ale_linters#terraform#tflint#Handle(123, [ - \ '[ { "detector": "aws_db_instance_readable_password", "type": "WARNING", "message": "be warned, traveller", "line": 12, "file": "github.com/wata727/example-module/aws_db_instance.tf", "link": "https://github.com/wata727/tflint/blob/master/docs/aws_db_instance_readable_password.md" }, { "detector": "aws_elasticache_cluster_invalid_type", "type": "ERROR", "message": "error message", "line": 9, "file": "github.com/wata727/example-module/aws_elasticache_cluster.tf", "link": "https://github.com/wata727/tflint/blob/master/docs/aws_elasticache_cluster_invalid_type.md" }, { "detector": "aws_instance_not_specified_iam_profile", "type": "NOTICE", "message": "just so ya know", "line": 5, "file": "github.com/wata727/example-module/aws_instance.tf", "link": "https://github.com/wata727/tflint/blob/master/docs/aws_instance_not_specified_iam_profile.md" } ]' - \ ]) - Execute(The tflint handler should parse items correctly): AssertEqual \ [ diff --git a/test/handler/test_thrift_handler.vader b/test/handler/test_thrift_handler.vader index 9bdb9378..c87986da 100644 --- a/test/handler/test_thrift_handler.vader +++ b/test/handler/test_thrift_handler.vader @@ -1,8 +1,8 @@ Before: - runtime ale_linters/thrift/thrift.vim + runtime ale_linters/thrift/thrift.vim After: - call ale#linter#Reset() + call ale#linter#Reset() Execute(The thrift handler should handle basic warnings and errors): AssertEqual diff --git a/test/handler/test_thriftcheck_handler.vader b/test/handler/test_thriftcheck_handler.vader index e80e5050..33811f77 100644 --- a/test/handler/test_thriftcheck_handler.vader +++ b/test/handler/test_thriftcheck_handler.vader @@ -1,8 +1,8 @@ Before: - runtime ale_linters/thrift/thriftcheck.vim + runtime ale_linters/thrift/thriftcheck.vim After: - call ale#linter#Reset() + call ale#linter#Reset() Execute(The thriftcheck handler should handle basic warnings and errors): AssertEqual diff --git a/test/handler/test_verilator_handler.vader b/test/handler/test_verilator_handler.vader index 59ec1361..efcf6619 100644 --- a/test/handler/test_verilator_handler.vader +++ b/test/handler/test_verilator_handler.vader @@ -4,7 +4,6 @@ Before: After: call ale#linter#Reset() - Execute (The verilator handler should parse legacy messages with only line numbers): AssertEqual \ [ @@ -26,7 +25,6 @@ Execute (The verilator handler should parse legacy messages with only line numbe \ '%Warning-BLKSEQ: bar.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=).', \ ]) - Execute (The verilator handler should parse new format messages with line and column numbers): AssertEqual \ [ @@ -49,4 +47,3 @@ Execute (The verilator handler should parse new format messages with line and co \ '%Error: bar.v:3:1: syntax error, unexpected endmodule, expecting ;', \ '%Warning-UNUSED: foo.v:4:6: Signal is not used: r', \ ]) - diff --git a/test/handler/test_vulture_handler.vader b/test/handler/test_vulture_handler.vader index b28055db..0756c3bb 100644 --- a/test/handler/test_vulture_handler.vader +++ b/test/handler/test_vulture_handler.vader @@ -9,8 +9,6 @@ After: call ale#test#RestoreDirectory() call ale#linter#Reset() - silent file something_else.py - Execute(Basic vulture check with relative path in result should be handled): call ale#test#SetFilename('something_else.py') AssertEqual 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): diff --git a/test/lsp/test_handling_window_requests.vader b/test/lsp/test_handling_window_requests.vader index 551d5975..5639dbc2 100644 --- a/test/lsp/test_handling_window_requests.vader +++ b/test/lsp/test_handling_window_requests.vader @@ -19,11 +19,12 @@ After: Execute(ale#lsp_window#HandleShowMessage() should only show errors when severity is set to "error"): let g:ale_lsp_show_message_severity = 'error' - call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':1,'message':'an error'}) + " We should escape the quotes from this message. + call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':1,'message':'an ''error'''}) call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':2,'message':'a warning'}) call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':3,'message':'an info'}) call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':4,'message':'a log'}) - AssertEqual ['Error:some_linter: an error'], g:expr_list + AssertEqual ['Error:some_linter: an ''error'''], g:expr_list Execute(ale#lsp_window#HandleShowMessage() should only show errors and warnings when severity is set to "warning"): let g:ale_lsp_show_message_severity = 'warning' @@ -88,7 +89,3 @@ Execute(ale#lsp_window#HandleShowMessage() should use "warning" when severity is \ 'Error:some_linter: an error', \ 'Warning:some_linter: a warning'], \ g:expr_list - -Execute(ale#lsp_window#HandleShowMessage() should escape quotes on messages): - call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':3,'message':"this is an 'info'"}) - AssertEqual ['Info:some_linter: this is an ''info'''], g:expr_list diff --git a/test/sign/test_sign_limits.vader b/test/sign/test_sign_limits.vader index d7a4e2f5..2b4942e6 100644 --- a/test/sign/test_sign_limits.vader +++ b/test/sign/test_sign_limits.vader @@ -40,11 +40,6 @@ Execute(0 signs should be set when the max is 0): AssertEqual [], SetNProblems(42) -Execute(1 signs should be set when the max is 1): - let g:ale_max_signs = 1 - - AssertEqual [1], SetNProblems(42) - Execute(10 signs should be set when the max is 10): let g:ale_max_signs = 10 diff --git a/test/sign/test_sign_placement.vader b/test/sign/test_sign_placement.vader index 7b80d83c..82532876 100644 --- a/test/sign/test_sign_placement.vader +++ b/test/sign/test_sign_placement.vader @@ -133,11 +133,11 @@ Execute(ale#sign#GetSignName should return the right sign names): \]) Given testft(A file with warnings/errors): - foo - bar - baz - fourth line - fifth line + Foo + Bar + Baz + Fourth line + Fifth line Execute(The current signs should be set for running a job): ALELint @@ -277,26 +277,6 @@ Execute(Signs should be upgraded correctly): \ sort(ParseSigns()) Execute(It should be possible to clear signs with empty lists): - let g:loclist = [ - \ {'bufnr': bufnr(''), 'lnum': 16, 'col': 2, 'type': 'E', 'text': 'f'}, - \] - - call ale#sign#SetSigns(bufnr(''), g:loclist) - - AssertEqual - \ [ - \ ['16', '1000001', 'ALEErrorSign'], - \ ], - \ sort(ParseSigns()) - - call ale#sign#SetSigns(bufnr(''), []) - - AssertEqual [], ParseSigns() - -Execute(No exceptions should be thrown when setting signs for invalid buffers): - call ale#sign#SetSigns(123456789, [{'lnum': 15, 'col': 2, 'type': 'W', 'text': 'e'}]) - -Execute(Signs should be removed when lines have multiple sign IDs on them): " We can fail to remove signs if there are multiple signs on one line, " say after deleting lines in Vim, etc. if has('nvim-0.4.2') || has('patch-8.1.614') @@ -313,3 +293,6 @@ Execute(Signs should be removed when lines have multiple sign IDs on them): call ale#sign#SetSigns(bufnr(''), []) AssertEqual [], ParseSigns() + +Execute(No exceptions should be thrown when setting signs for invalid buffers): + call ale#sign#SetSigns(123456789, [{'lnum': 15, 'col': 2, 'type': 'W', 'text': 'e'}]) |