diff options
author | w0rp <devw0rp@gmail.com> | 2023-09-16 22:22:01 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2023-09-16 22:23:30 +0100 |
commit | ae1d0515049ed135878672e06b51b083f5ae384d (patch) | |
tree | 1556645edaf786bc934be9cc8cc63408e65054d4 /test/handler | |
parent | 4b11cf21dc8406b579b89e50ae3f08ef2c0856e1 (diff) | |
download | ale-ae1d0515049ed135878672e06b51b083f5ae384d.zip |
#4454 Clean up more tests and code
* Remove some tests we no longer need
* Delete blocks of redundant code
* Compress some tests together to simplify them
* Remove a little code for ancient linter versions
* Escape more executables we didn't escape before
* Rename a deno option that didn't match our conventions
Diffstat (limited to 'test/handler')
45 files changed, 60 insertions, 269 deletions
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 |