diff options
Diffstat (limited to 'test/handler')
28 files changed, 892 insertions, 31 deletions
diff --git a/test/handler/test_ameba_handler.vader b/test/handler/test_ameba_handler.vader new file mode 100644 index 00000000..a6f43170 --- /dev/null +++ b/test/handler/test_ameba_handler.vader @@ -0,0 +1,44 @@ +Before: + runtime ale_linters/crystal/ameba.vim + +After: + unlet! g:lines + call ale#linter#Reset() + +Execute(The ameba handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 24, + \ 'col': 28, + \ 'end_col': 29, + \ 'text': 'Trailing whitespace detected', + \ 'code': 'Layout/TrailingWhitespace', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#crystal#ameba#HandleAmebaOutput(123, [ + \ '{"sources":[{"path":"my_file_with_issues.cr","issues":[{"rule_name":"Layout/TrailingWhitespace","message":"Trailing whitespace detected","location":{"line":24,"column":28},"end_location":{"line":null,"column":null}}]},{"path":"my_file_without_issues.cr","issues":[]}],"metadata":{"ameba_version":"0.8.1","crystal_version":"0.26.1"},"summary":{"target_sources_count":2,"issues_count":1}}' + \ ]) + +Execute(The ameba handler should handle when files are checked and no offenses are found): + AssertEqual + \ [], + \ ale_linters#crystal#ameba#HandleAmebaOutput(123, [ + \ '{"sources":[{"path":"my_file_with_issues.cr",issues":[]},{"path":"my_file_without_issues.cr",issues":[]}],"metadata":{ameba_version":"0.8.1",crystal_version":"0.26.1"},"summary":{target_sources_count":2,issues_count":0}}' + \ ]) + +Execute(The ameba handler should handle when no files are checked): + AssertEqual + \ [], + \ ale_linters#crystal#ameba#HandleAmebaOutput(123, [ + \ '{"sources":[],"metadata":{ameba_version":"0.8.1",crystal_version":"0.26.1"},"summary":{target_sources_count":0,issues_count":0}}' + \ ]) + +Execute(The ameba handler should handle blank output without any errors): + AssertEqual + \ [], + \ ale_linters#crystal#ameba#HandleAmebaOutput(123, ['{}']) + AssertEqual + \ [], + \ ale_linters#crystal#ameba#HandleAmebaOutput(123, []) diff --git a/test/handler/test_bandit_handler.vader b/test/handler/test_bandit_handler.vader new file mode 100644 index 00000000..a2793a46 --- /dev/null +++ b/test/handler/test_bandit_handler.vader @@ -0,0 +1,42 @@ +Before: + runtime ale_linters/python/bandit.vim + +After: + call ale#linter#Reset() + +Execute(The bandit handler for Python should parse input correctly): + AssertEqual + \ [ + \ { + \ 'bufnr': 0, + \ 'lnum': 2, + \ 'code': 'B404', + \ 'type': 'I', + \ 'text': 'Consider possible security implications associated with subprocess module.', + \ }, + \ { + \ 'bufnr': 0, + \ 'lnum': 4, + \ 'code': 'B305', + \ 'type': 'W', + \ 'text': 'Use of insecure cipher mode cryptography.hazmat.primitives.ciphers.modes.ECB.', + \ }, + \ { + \ 'bufnr': 0, + \ 'lnum': 6, + \ 'code': 'B609', + \ 'type': 'E', + \ 'text': 'Possible wildcard injection in call: subprocess.Popen', + \ }, + \ ], + \ ale_linters#python#bandit#Handle(0, [ + \ '[main] INFO profile include tests: None', + \ '[main] INFO profile exclude tests: None', + \ '[main] INFO cli include tests: None', + \ '[main] INFO cli exclude tests: None', + \ '[main] INFO running on Python 3.7.2', + \ '[node_visitor] INFO Unable to find qualified name for module: <stdin>', + \ '2:B404:LOW:Consider possible security implications associated with subprocess module.', + \ '4:B305:MEDIUM:Use of insecure cipher mode cryptography.hazmat.primitives.ciphers.modes.ECB.', + \ '6:B609:HIGH:Possible wildcard injection in call: subprocess.Popen', + \ ]) diff --git a/test/handler/test_clojure_clj_kondo_handler.vader b/test/handler/test_clojure_clj_kondo_handler.vader new file mode 100644 index 00000000..45db9049 --- /dev/null +++ b/test/handler/test_clojure_clj_kondo_handler.vader @@ -0,0 +1,75 @@ +Before: + runtime ale_linters/clojure/clj_kondo.vim + +After: + call ale#linter#Reset() + +Execute(the clojure clj-kondo handler should be able to handle errors): + AssertEqual + \ [ + \ { + \ 'lnum': 123, + \ 'col': 44, + \ 'type': 'E', + \ 'text': 'error: Unexpected )', + \ }, + \ ], + \ ale_linters#clojure#clj_kondo#HandleCljKondoFormat(0, [ + \ 'test.clj:123:44: error: Unexpected )', + \ ]) + +Execute(the clojure clj-kondo handler should be able to handle warnings): + AssertEqual + \ [ + \ { + \ 'lnum': 654, + \ 'col': 321, + \ 'type': 'W', + \ 'text': 'warning: inline def', + \ } + \ ], + \ ale_linters#clojure#clj_kondo#HandleCljKondoFormat(0, [ + \ 'test.clj:654:321: warning: inline def' + \ ]) + +Execute(the clojure clj-kondo handler should be able to handle exceptions): + AssertEqual + \ [ + \ { + \ 'lnum': 123, + \ 'col': 321, + \ 'type': 'E', + \ 'text': 'Exception: something horrible happen', + \ } + \ ], + \ ale_linters#clojure#clj_kondo#HandleCljKondoFormat(0, [ + \ 'test.clj:123:321: Exception: something horrible happen' + \ ]) + +Execute(the clojure clj-kondo handler should be able to handle errors from stdin): + AssertEqual + \ [ + \ { + \ 'lnum': 16, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'error: Unexpected )', + \ }, + \ ], + \ ale_linters#clojure#clj_kondo#HandleCljKondoFormat(0, [ + \ '<stdin>:16:1: error: Unexpected )', + \ ]) + +Execute(the clojure clj-kondo handler should be able to handle windows files): + AssertEqual + \ [ + \ { + \ 'lnum': 123, + \ 'col': 44, + \ 'type': 'E', + \ 'text': 'error: Unexpected )', + \ } + \ ], + \ ale_linters#clojure#clj_kondo#HandleCljKondoFormat(0, [ + \ 'C:\my\operating\system\is\silly\core.clj:123:44: error: Unexpected )', + \ ]) diff --git a/test/handler/test_cookstyle_handler.vader b/test/handler/test_cookstyle_handler.vader new file mode 100644 index 00000000..7d705a19 --- /dev/null +++ b/test/handler/test_cookstyle_handler.vader @@ -0,0 +1,22 @@ +Before: + runtime ale_linters/chef/cookstyle.vim + +After: + call ale#linter#Reset() + +Execute(Basic warnings should be handled): + AssertEqual + \ [ + \ { + \ 'lnum': 58, + \ 'col': 24, + \ 'code': 'Style/UnneededInterpolation', + \ 'type': 'W', + \ 'end_col': 40, + \ 'text': 'Style/UnneededInterpolation: Prefer `to_s` over string interpolation.', + \ } + \ ], + \ 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_cypher_lint_handler.vader b/test/handler/test_cypher_lint_handler.vader new file mode 100644 index 00000000..066adae4 --- /dev/null +++ b/test/handler/test_cypher_lint_handler.vader @@ -0,0 +1,21 @@ +Before: + runtime ale_linters/cypher/cypher_lint.vim + +After: + call ale#linter#Reset() + +Execute(The cypher-lint handler should handle errors for the current file correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 75, + \ 'type': 'E', + \ 'text': "Invalid input ',': expected an identifier, shortestPath, allShortestPaths or '('", + \ }, + \ ], + \ ale_linters#cypher#cypher_lint#Handle(bufnr(''), [ + \ "shakespeare.cql:1:75: Invalid input ',': expected an identifier, shortestPath, allShortestPaths or '('", + \ "CREATE (shakespeare:Author {firstname:'William', lastname:'Shakespeare'}),,", + \ " ^", + \ ]) diff --git a/test/handler/test_eslint_handler.vader b/test/handler/test_eslint_handler.vader index 4a57927b..1bb438a6 100644 --- a/test/handler/test_eslint_handler.vader +++ b/test/handler/test_eslint_handler.vader @@ -342,6 +342,17 @@ Execute(eslint should warn about ignored files by default): \ '/path/to/some/ignored.js:0:0: File ignored because of a matching ignore pattern. Use "--no-ignore" to override. [Warning]', \ ]) + AssertEqual + \ [{ + \ 'lnum': 0, + \ 'col': 0, + \ 'type': 'W', + \ 'text': 'File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override.', + \ }], + \ ale#handlers#eslint#Handle(bufnr(''), [ + \ '/path/to/some/ignored.js:0:0: File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override. [Warning]', + \ ]) + Execute(eslint should not warn about ignored files when explicitly disabled): let g:ale_javascript_eslint_suppress_eslintignore = 1 @@ -351,6 +362,12 @@ Execute(eslint should not warn about ignored files when explicitly disabled): \ '/path/to/some/ignored.js:0:0: File ignored because of a matching ignore pattern. Use "--no-ignore" to override. [Warning]', \ ]) + AssertEqual + \ [], + \ ale#handlers#eslint#Handle(bufnr(''), [ + \ '/path/to/some/ignored.js:0:0: File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override. [Warning]', + \ ]) + Execute(eslint should handle react errors correctly): AssertEqual \ [ diff --git a/test/handler/test_fecs_handler.vader b/test/handler/test_fecs_handler.vader new file mode 100644 index 00000000..7c216b8d --- /dev/null +++ b/test/handler/test_fecs_handler.vader @@ -0,0 +1,35 @@ +Before: + runtime autoload/ale/handlers/fecs.vim + +After: + call ale#linter#Reset() + +Execute(fecs should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 20, + \ 'col': 25, + \ 'text': 'Unexpected console statement.', + \ 'code': 'no-console', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 24, + \ 'col': 36, + \ 'text': 'Missing radix parameter.', + \ 'code': 'radix', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 25, + \ 'col': 6, + \ 'text': 'Missing static property value.', + \ 'type': 'E', + \ }, + \ ], + \ ale#handlers#fecs#Handle(347, [ + \ 'fecs WARN → line 20, col 25: Unexpected console statement. (no-console)', + \ 'fecs ERROR → line 24, col 36: Missing radix parameter. (radix)', + \ 'fecs ERROR → line 25, col 6: Missing static property value.', + \ ]) diff --git a/test/handler/test_flake8_handler.vader b/test/handler/test_flake8_handler.vader index cdf20bc0..1c9956fa 100644 --- a/test/handler/test_flake8_handler.vader +++ b/test/handler/test_flake8_handler.vader @@ -113,7 +113,7 @@ Execute(The flake8 handler should handle stack traces): \ [ \ { \ 'lnum': 1, - \ 'text': 'An exception was thrown. See :ALEDetail', + \ 'text': 'ImportError: No module named parser (See :ALEDetail)', \ 'detail': join([ \ 'Traceback (most recent call last):', \ ' File "/usr/local/bin/flake8", line 7, in <module>', @@ -258,3 +258,19 @@ Execute(E112 should be a syntax error): \ ale_linters#python#flake8#Handle(bufnr(''), [ \ 'foo.py:6:1: E112 expected an indented block', \ ]) + +Execute(Compatibility with hacking which uses older style flake8): + AssertEqual + \ [ + \ { + \ 'lnum': 6, + \ 'col': 1, + \ 'vcol': 1, + \ 'code': 'H306', + \ 'type': 'W', + \ 'text': 'imports not in alphabetical order (smtplib, io)', + \ }, + \ ], + \ ale_linters#python#flake8#Handle(bufnr(''), [ + \ 'foo.py:6:1: H306: imports not in alphabetical order (smtplib, io)', + \ ]) diff --git a/test/handler/test_flow_handler.vader b/test/handler/test_flow_handler.vader index 3a575a01..055ba026 100644 --- a/test/handler/test_flow_handler.vader +++ b/test/handler/test_flow_handler.vader @@ -499,7 +499,8 @@ Execute(The flow handler should handle extra errors): \ 'col': 35, \ 'type': 'E', \ 'text': 'props of React element `New`: This type is incompatible with object type', - \ 'detail': 'Property `setVector` is incompatible: number This type is incompatible with function type ', + \ 'detail': 'props of React element `New`: This type is incompatible with object type' + \ . "\nProperty `setVector` is incompatible: number This type is incompatible with function type ", \ } \] diff --git a/test/handler/test_ghdl_handler.vader b/test/handler/test_ghdl_handler.vader new file mode 100644 index 00000000..a0f5edac --- /dev/null +++ b/test/handler/test_ghdl_handler.vader @@ -0,0 +1,26 @@ +Before: + runtime ale_linters/vhdl/ghdl.vim + +After: + call ale#linter#Reset() + +Execute(The ghdl handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 41, + \ 'col' : 5, + \ 'type': 'E', + \ 'text': "error: 'begin' is expected instead of 'if'" + \ }, + \ { + \ 'lnum': 12, + \ 'col' : 8, + \ 'type': 'E', + \ 'text': ' no declaration for "i0"' + \ }, + \ ], + \ ale_linters#vhdl#ghdl#Handle(bufnr(''), [ + \ "dff_en.vhd:41:5:error: 'begin' is expected instead of 'if'", + \ '/path/to/file.vhdl:12:8: no declaration for "i0"', + \ ]) diff --git a/test/handler/test_ktlint_handler.vader b/test/handler/test_ktlint_handler.vader new file mode 100644 index 00000000..f0d634e6 --- /dev/null +++ b/test/handler/test_ktlint_handler.vader @@ -0,0 +1,21 @@ +Before: + Save g:ale_kotlin_ktlint_rulesets + + let g:ale_kotlin_ktlint_rulesets = [] + +After: + Restore + +Execute(The ktlint handler method GetRulesets should properly parse custom rulesets): + let g:ale_kotlin_ktlint_rulesets = ['/path/to/custom/ruleset.jar', '/path/to/other/ruleset.jar'] + + AssertEqual + \ '--ruleset /path/to/custom/ruleset.jar --ruleset /path/to/other/ruleset.jar', + \ ale#handlers#ktlint#GetRulesets(bufnr('')) + +Execute(The ktlint handler method GetRulesets should return an empty string when no rulesets have been configured): + let g:ale_kotlin_ktlint_rulesets = [] + + AssertEqual + \ '', + \ ale#handlers#ktlint#GetRulesets(bufnr('')) diff --git a/test/handler/test_lacheck_handler.vader b/test/handler/test_lacheck_handler.vader new file mode 100644 index 00000000..0bcc3be8 --- /dev/null +++ b/test/handler/test_lacheck_handler.vader @@ -0,0 +1,36 @@ +Before: + runtime ale_linters/tex/lacheck.vim + call ale#test#SetDirectory('/testplugin/test') + +After: + call ale#linter#Reset() + call ale#test#RestoreDirectory() + +Execute(The lacheck handler should parse lines correctly): + + call ale#test#SetFilename('command_callback/tex_paths/sample1.tex') + + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'type': 'W', + \ 'text': 'perhaps you should insert a `~'' before "\ref"' + \ } + \ ], + \ ale_linters#tex#lacheck#Handle(bufnr(''), [ + \ "** sample1:", + \ "\"sample1.tex\", line 1: perhaps you should insert a `~' before \"\\ref\"" + \ ]) + +Execute(The lacheck handler should ignore errors from input files): + + call ale#test#SetFilename('ale_test.tex') + + AssertEqual + \ [ + \ ], + \ ale_linters#tex#lacheck#Handle(255, [ + \ "** ale_input:", + \ "\"ale_input.tex\", line 1: perhaps you should insert a `~' before \"\\ref\"" + \ ]) diff --git a/test/handler/test_languagetool_handler.vader b/test/handler/test_languagetool_handler.vader new file mode 100644 index 00000000..61d3abfd --- /dev/null +++ b/test/handler/test_languagetool_handler.vader @@ -0,0 +1,62 @@ +Before: + runtime! ale_linters/text/languagetool.vim + +After: + call ale#linter#Reset() + +Execute(languagetool handler should report 3 errors): + AssertEqual + \ [ + \ { + \ 'lnum': 3, + \ 'col': 19, + \ 'end_col': 20, + \ 'text': 'This sentence does not start with an uppercase letter', + \ 'type': 'W', + \ 'code': 'UPPERCASE_SENTENCE_START', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 36, + \ 'end_col': 42, + \ 'text': "Did you mean 'to see'?", + \ 'type': 'W', + \ 'code': 'TOO_TO[1]', + \ }, + \ { + \ 'lnum': 3, + \ 'col': 44, + \ 'end_col': 45, + \ 'text': "Use 'a' instead of 'an' if the following word doesn't start with a vowel sound, e.g. 'a sentence', 'a university'", + \ 'type': 'W', + \ 'code': 'EN_A_VS_AN', + \ } + \ ], + \ ale#handlers#languagetool#HandleOutput(bufnr(''), [ + \ '1.) Line 3, column 19, Rule ID: UPPERCASE_SENTENCE_START', + \ 'Message: This sentence does not start with an uppercase letter', + \ 'Suggestion: Or', + \ '...red phrases for details on potential errors. or use this text too see an few of of the probl...', + \ ' ^^ ', + \ '', + \ '2.) Line 3, column 36, Rule ID: TOO_TO[1]', + \ "Message: Did you mean 'to see'?", + \ 'Suggestion: to see', + \ '...etails on potential errors. or use this text too see an few of of the problems that LanguageTool ...', + \ ' ^^^^^^^ ', + \ '', + \ '3.) Line 3, column 44, Rule ID: EN_A_VS_AN', + \ "Message: Use 'a' instead of 'an' if the following word doesn't start with a vowel sound, e.g. 'a sentence', 'a university'", + \ 'Suggestion: a', + \ '...n potential errors. or use this text too see an few of of the problems that LanguageTool can...', + \ ' ^^ ', + \ 'Time: 2629ms for 8 sentences (3.0 sentences/sec)' + \ ]) + +Execute(languagetool handler should report no errors on empty input): + AssertEqual + \ [], + \ ale#handlers#languagetool#HandleOutput(bufnr(''), [ + \ '', + \ 'Time: 2629ms for 8 sentences (3.0 sentences/sec)' + \ ]) diff --git a/test/handler/test_perl_handler.vader b/test/handler/test_perl_handler.vader index e769550c..060b1ffe 100644 --- a/test/handler/test_perl_handler.vader +++ b/test/handler/test_perl_handler.vader @@ -91,3 +91,19 @@ Execute(The Perl linter reports errors even when mixed with warnings): \ 'syntax error at - line 8, at EOF', \ 'Execution of t.pl aborted due to compilation errors.', \ ]) + +Execute(The Perl linter reports errors even when an additional file location is included): + AssertEqual + \ [ + \ {'lnum': '5', 'type': 'E', 'text': '"my" variable $foo masks earlier declaration in same scope'}, + \ {'lnum': '6', 'type': 'E', 'text': '"my" variable $foo masks earlier declaration in same scope'}, + \ {'lnum': '11', 'type': 'E', 'text': 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?)'}, + \ {'lnum': '12', 'type': 'E', 'text': 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?)'}, + \ ], + \ ale_linters#perl#perl#Handle(bufnr(''), [ + \ '"my" variable $foo masks earlier declaration in same scope at - line 5.', + \ '"my" variable $foo masks earlier declaration in same scope at - line 6, at <DATA> line 1.', + \ 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?) at - line 11.', + \ 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?) at - line 12, <DATA> line 1.', + \ 'Execution of t.pl aborted due to compilation errors.', + \ ]) diff --git a/test/handler/test_phpstan_handler.vader b/test/handler/test_phpstan_handler.vader index 207a7758..67fdb759 100644 --- a/test/handler/test_phpstan_handler.vader +++ b/test/handler/test_phpstan_handler.vader @@ -14,7 +14,7 @@ Execute(Output without errors should be parsed correctly): AssertEqual \ [], - \ ale_linters#php#phpstan#Handle(bufnr(''), [" 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%"]) + \ ale_linters#php#phpstan#Handle(bufnr(''), []) Execute(Output with some errors should be parsed correctly): call ale#test#SetFilename('phpstan-test-files/foo/test.php') @@ -24,21 +24,20 @@ Execute(Output with some errors should be parsed correctly): \ { \ 'lnum': 9, \ 'text': 'Call to method format() on an unknown class DateTimeImutable.', - \ 'type': 'W' + \ 'type': 'E' \ }, \ { \ 'lnum': 16, \ 'text': 'Sample message.', - \ 'type': 'W' + \ 'type': 'E' \ }, \ { \ 'lnum': 192, \ 'text': 'Invalid command testCommand.', - \ 'type': 'W' + \ 'type': 'E' \ } \ ], \ ale_linters#php#phpstan#Handle(bufnr(''), [ - \ ' 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%', \ 'phpstan-test-files/foo/test.php:9:Call to method format() on an unknown class DateTimeImutable.', \ 'phpstan-test-files/foo/test.php:16:Sample message.', \ 'phpstan-test-files/foo/test.php:192:Invalid command testCommand.', @@ -52,11 +51,10 @@ Execute(Output should be parsed correctly with Windows paths): \ { \ 'lnum': 9, \ 'text': 'Access to an undefined property Test::$var.', - \ 'type': 'W' + \ 'type': 'E' \ } \ ], \ ale_linters#php#phpstan#Handle(bufnr(''), [ - \ ' 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%', \ 'D:\phpstan-test-files\foo\test.php:9:Access to an undefined property Test::$var.', \]) @@ -68,10 +66,9 @@ Execute(Output for .inc files should be parsed correctly): \ { \ 'lnum': 9, \ 'text': 'Access to an undefined property Test::$var.', - \ 'type': 'W' + \ 'type': 'E' \ } \ ], \ ale_linters#php#phpstan#Handle(bufnr(''), [ - \ ' 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%', \ '/phpstan-test-files/foo/test.inc:9:Access to an undefined property Test::$var.', \]) diff --git a/test/handler/test_powershell_handler.vader b/test/handler/test_powershell_handler.vader new file mode 100755 index 00000000..635bcd20 --- /dev/null +++ b/test/handler/test_powershell_handler.vader @@ -0,0 +1,62 @@ +Before: + runtime ale_linters/powershell/powershell.vim + +After: + call ale#linter#Reset() + +Execute(The powershell handler should process syntax errors from parsing a powershell script): + AssertEqual + \ [ + \ { + \ 'lnum': 8, + \ 'col': 29, + \ 'type': 'E', + \ 'text': 'Missing closing ''}'' in statement block or type definition.', + \ 'code': 'ParseException', + \ }, + \ ], + \ ale_linters#powershell#powershell#Handle(bufnr(''), [ + \ "At line:8 char:29", + \ "+ Invoke-Command -ScriptBlock {", + \ "+ ~", + \ "Missing closing '}' in statement block or type definition.", + \ "At /home/harrisj/tester.ps1:5 char:5", + \ "+ [void]$ExecutionContext.InvokeCommand.NewScriptBlock($Contents);", + \ "+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", + \ "+ CategoryInfo : NotSpecified: (:) [], ParseException", + \ "+ FullyQualifiedErrorId : ParseException" + \ ]) + +Execute(The powershell handler should process multiple syntax errors from parsing a powershell script): + AssertEqual + \ [ + \ { + \ 'lnum': 11, + \ 'col': 31, + \ 'type': 'E', + \ 'text': 'The string is missing the terminator: ".', + \ 'code': 'ParseException' + \ }, + \ { + \ 'lnum': 3, + \ 'col': 16, + \ 'type': 'E', + \ 'text': 'Missing closing ''}'' in statement block or type definition.', + \ 'code': 'ParseException' + \ }, + \ ], + \ ale_linters#powershell#powershell#Handle(bufnr(''), [ + \ 'At line:11 char:31', + \ '+ write-verbose ''deleted''', + \ '+ ~', + \ 'The string is missing the terminator: ".', + \ 'At line:3 char:16', + \ '+ invoke-command {', + \ '+ ~', + \ 'Missing closing ''}'' in statement block or type definition.', + \ 'At /var/folders/qv/15ybvt050v9cgwrm7c95x4r4zc4qsg/T/vwhzIc8/1/script.ps1:1 char:150', + \ '+ ... ontents); [void]$ExecutionContext.InvokeCommand.NewScriptBlock($Con ...', + \ '+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~', + \ '+ CategoryInfo : NotSpecified: (:) [], ParseException', + \ '+ FullyQualifiedErrorId : ParseException' + \ ]) diff --git a/test/handler/test_psscriptanalyzer_handler.vader b/test/handler/test_psscriptanalyzer_handler.vader new file mode 100644 index 00000000..060d5941 --- /dev/null +++ b/test/handler/test_psscriptanalyzer_handler.vader @@ -0,0 +1,42 @@ +Before: + runtime ale_linters/powershell/psscriptanalyzer.vim + +After: + call ale#linter#Reset() + +Execute(The psscriptanalyzer handler should handle basic information or warnings): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'type': 'I', + \ 'text': 'The cmdlet ''Get-GithubRepo'' does not have a help comment.', + \ 'code': 'PSProvideCommentHelp', + \ }, + \ { + \ 'lnum': 9, + \ 'type': 'W', + \ 'text': '''%'' is an alias of ''ForEach-Object''. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.', + \ 'code': 'PSAvoidUsingCmdletAliases', + \ }, + \ { + \ 'lnum': 23, + \ 'type': 'E', + \ 'text': 'The ComputerName parameter of a cmdlet should not be hardcoded as this will expose sensitive information about the system.', + \ 'code': 'PSAvoidUsingComputerNameHardcoded', + \ }, + \ ], + \ ale_linters#powershell#psscriptanalyzer#Handle(bufnr(''), [ + \ '1', + \ 'Information', + \ 'The cmdlet ''Get-GithubRepo'' does not have a help comment.', + \ 'PSProvideCommentHelp', + \ '9', + \ 'Warning', + \ '''%'' is an alias of ''ForEach-Object''. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.', + \ 'PSAvoidUsingCmdletAliases', + \ '23', + \ 'Error', + \ 'The ComputerName parameter of a cmdlet should not be hardcoded as this will expose sensitive information about the system.', + \ 'PSAvoidUsingComputerNameHardcoded', + \ ]) diff --git a/test/handler/test_pydocstyle_handler.vader b/test/handler/test_pydocstyle_handler.vader index d155dc9a..cfb75307 100644 --- a/test/handler/test_pydocstyle_handler.vader +++ b/test/handler/test_pydocstyle_handler.vader @@ -66,7 +66,7 @@ Execute(Basic pydocstyle warnings should be handled): \ ], \ ale_linters#python#pydocstyle#Handle(bufnr(''), [ \ 'Checking file ' . fnamemodify(bufname(bufnr('')), ':p') . '.', - \ ale#Escape(fnamemodify(bufname(bufnr('')), ':t')) . ':1 at module level:', + \ './mydir/myfile.py:1 at module level:', \ ' D100: Missing docstring in public module', \ '', \ ' All modules should normally have docstrings. [...] all functions and', @@ -80,7 +80,7 @@ Execute(Basic pydocstyle warnings should be handled): \ ' 1: # 2: 3: s 4: a 5: m 6: p 7: l ...', \ '', \ '', - \ ale#Escape(fnamemodify(bufname(bufnr('')), ':t')) . ':4 in public function `main`:', + \ 'C:\mydir\myfile.py:4 in public function `main`:', \ ' D205: 1 blank line required between summary line and description (found 0)', \ '', \ ' Multi-line docstrings consist of a summary line just like a one-line', @@ -92,7 +92,7 @@ Execute(Basic pydocstyle warnings should be handled): \ ' 3: d 4: e 5: f 6: 7: m 8: a 9: i ...', \ '', \ '', - \ ale#Escape(fnamemodify(bufname(bufnr('')), ':t')) . ':4 in public function `main`:', + \ 'myfile.py:4 in public function `main`:', \ ' D400: First line should end with a period (not ''e'')', \ '', \ ' The [first line of a] docstring is a phrase ending in a period.', diff --git a/test/handler/test_pylama_handler.vader b/test/handler/test_pylama_handler.vader new file mode 100644 index 00000000..d21c65d3 --- /dev/null +++ b/test/handler/test_pylama_handler.vader @@ -0,0 +1,193 @@ +Before: + Save g:ale_warn_about_trailing_whitespace + + let g:ale_warn_about_trailing_whitespace = 1 + + runtime ale_linters/python/pylama.vim + +After: + Restore + + call ale#linter#Reset() + + silent file something_else.py + +Execute(The pylama handler should handle no messages): + AssertEqual [], ale_linters#python#pylama#Handle(bufnr(''), []) + +Execute(The pylama handler should handle basic warnings and syntax errors): + AssertEqual + \ [ + \ { + \ 'lnum': 8, + \ 'col': 1, + \ 'code': 'W0611', + \ 'type': 'W', + \ 'sub_type': '', + \ 'text': '''foo'' imported but unused [pyflakes]', + \ }, + \ { + \ 'lnum': 8, + \ 'col': 0, + \ 'code': 'E0401', + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'Unable to import ''foo'' [pylint]', + \ }, + \ { + \ 'lnum': 10, + \ 'col': 1, + \ 'code': 'E302', + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'expected 2 blank lines, found 1 [pycodestyle]', + \ }, + \ { + \ 'lnum': 11, + \ 'col': 1, + \ 'code': 'D401', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'First line should be in imperative mood (''Get'', not ''Gets'') [pydocstyle]', + \ }, + \ { + \ 'lnum': 15, + \ 'col': 81, + \ 'code': 'E501', + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'line too long (96 > 80 characters) [pycodestyle]', + \ }, + \ { + \ 'lnum': 16, + \ 'col': 1, + \ 'code': 'D203', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': '1 blank line required before class docstring (found 0) [pydocstyle]', + \ }, + \ { + \ 'lnum': 18, + \ 'col': 1, + \ 'code': 'D107', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'Missing docstring in __init__ [pydocstyle]', + \ }, + \ { + \ 'lnum': 20, + \ 'col': 0, + \ 'code': 'C4001', + \ 'type': 'W', + \ 'sub_type': 'style', + \ 'text': 'Invalid string quote ", should be '' [pylint]', + \ }, + \ ], + \ ale_linters#python#pylama#Handle(bufnr(''), [ + \ 'No config file found, using default configuration', + \ 'index.py:8:1: W0611 ''foo'' imported but unused [pyflakes]', + \ 'index.py:8:0: E0401 Unable to import ''foo'' [pylint]', + \ 'index.py:10:1: E302 expected 2 blank lines, found 1 [pycodestyle]', + \ 'index.py:11:1: D401 First line should be in imperative mood (''Get'', not ''Gets'') [pydocstyle]', + \ 'index.py:15:81: E501 line too long (96 > 80 characters) [pycodestyle]', + \ 'index.py:16:1: D203 1 blank line required before class docstring (found 0) [pydocstyle]', + \ 'index.py:18:1: D107 Missing docstring in __init__ [pydocstyle]', + \ 'index.py:20:0: C4001 Invalid string quote ", should be '' [pylint]', + \ ]) + +Execute(The pylama handler should handle tracebacks with parsable messages): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'text': 'ParseError: Cannot parse file. (See :ALEDetail)', + \ 'detail': join([ + \ 'Traceback (most recent call last):', + \ ' File "/usr/local/lib/python2.7/site-packages/pylama/core.py", line 66, in run', + \ ' path, code=code, ignore=ignore, select=select, params=lparams)', + \ ' File "/usr/local/lib/python2.7/site-packages/pylama/lint/pylama_pydocstyle.py", line 37, in run', + \ ' } for e in PyDocChecker().check_source(*check_source_args)]', + \ ' File "/usr/local/lib/python2.7/site-packages/pydocstyle/checker.py", line 64, in check_source', + \ ' module = parse(StringIO(source), filename)', + \ ' File "/usr/local/lib/python2.7/site-packages/pydocstyle/parser.py", line 340, in __call__', + \ ' return self.parse(*args, **kwargs)', + \ ' File "/usr/local/lib/python2.7/site-packages/pydocstyle/parser.py", line 328, in parse', + \ ' six.raise_from(ParseError(), error)', + \ ' File "/usr/local/lib/python2.7/site-packages/six.py", line 737, in raise_from', + \ ' raise value', + \ 'ParseError: Cannot parse file.', + \ ], "\n"), + \ }, + \ { + \ 'lnum': 11, + \ 'col': 1, + \ 'code': 'E302', + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'expected 2 blank lines, found 1 [pycodestyle]', + \ }, + \ { + \ 'lnum': 16, + \ 'col': 81, + \ 'code': 'E501', + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'line too long (96 > 80 characters) [pycodestyle]', + \ }, + \ ], + \ ale_linters#python#pylama#Handle(bufnr(''), [ + \ 'Traceback (most recent call last):', + \ ' File "/usr/local/lib/python2.7/site-packages/pylama/core.py", line 66, in run', + \ ' path, code=code, ignore=ignore, select=select, params=lparams)', + \ ' File "/usr/local/lib/python2.7/site-packages/pylama/lint/pylama_pydocstyle.py", line 37, in run', + \ ' } for e in PyDocChecker().check_source(*check_source_args)]', + \ ' File "/usr/local/lib/python2.7/site-packages/pydocstyle/checker.py", line 64, in check_source', + \ ' module = parse(StringIO(source), filename)', + \ ' File "/usr/local/lib/python2.7/site-packages/pydocstyle/parser.py", line 340, in __call__', + \ ' return self.parse(*args, **kwargs)', + \ ' File "/usr/local/lib/python2.7/site-packages/pydocstyle/parser.py", line 328, in parse', + \ ' six.raise_from(ParseError(), error)', + \ ' File "/usr/local/lib/python2.7/site-packages/six.py", line 737, in raise_from', + \ ' raise value', + \ 'ParseError: Cannot parse file.', + \ '', + \ 'index.py:11:1: E302 expected 2 blank lines, found 1 [pycodestyle]', + \ 'index.py:16:81: E501 line too long (96 > 80 characters) [pycodestyle]', + \ ]) + +" Note: This is probably a bug, since all pylama plugins produce codes, but +" should be handled for compatibility. +" Note: The pylama isort plugin is distributed in the isort package. +Execute(The pylama handler should handle messages without codes): + AssertEqual + \ [ + \ { + \ 'lnum': 0, + \ 'col': 0, + \ 'code': '', + \ 'type': 'W', + \ 'sub_type': '', + \ 'text': 'Incorrectly sorted imports. [isort]' + \ }, + \ ], + \ ale_linters#python#pylama#Handle(bufnr(''), [ + \ 'index.py:0:0: Incorrectly sorted imports. [isort]', + \ ]) + +" Note: This is a pylama bug, but should be handled for compatibility. +" See https://github.com/klen/pylama/pull/146 +Execute(The pylama handler should handle message codes followed by a colon): + AssertEqual + \ [ + \ { + \ 'lnum': 31, + \ 'col': 1, + \ 'code': 'E800', + \ 'type': 'E', + \ 'sub_type': '', + \ 'text': 'Found commented out code: # needs_sphinx = ''1.0'' [eradicate]', + \ }, + \ ], + \ ale_linters#python#pylama#Handle(bufnr(''), [ + \ 'index.py:31:1: E800: Found commented out code: # needs_sphinx = ''1.0'' [eradicate]', + \ ]) diff --git a/test/handler/test_raco_handler.vader b/test/handler/test_raco_handler.vader new file mode 100644 index 00000000..217fe2f9 --- /dev/null +++ b/test/handler/test_raco_handler.vader @@ -0,0 +1,26 @@ +Before: + runtime ale_linters/racket/raco.vim + +After: + call ale#linter#Reset() + +Execute(The raco handler should handle errors for the current file correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 4, + \ 'col': 1, + \ 'type': 'E', + \ 'text': 'dfine: unbound identifier in modulemessage', + \ }, + \ ], + \ ale_linters#racket#raco#Handle(bufnr(''), [ + \ 'foo.rkt:4:1: dfine: unbound identifier in modulemessage', + \ ' in: dfine', + \ ' context...:', + \ ' /usr/local/Cellar/racket/6.5/share/racket/pkgs/compiler-lib/compiler/commands/expand.rkt:34:15: loop', + \ ' /usr/local/Cellar/racket/6.5/share/racket/pkgs/compiler-lib/compiler/commands/expand.rkt:10:2: show-program', + \ ' /usr/local/Cellar/racket/6.5/share/racket/pkgs/compiler-lib/compiler/commands/expand.rkt: [running body]', + \ ' /usr/local/Cellar/minimal-racket/6.6/share/racket/collects/raco/raco.rkt: [running body]', + \ ' /usr/local/Cellar/minimal-racket/6.6/share/racket/collects/raco/main.rkt: [running body]', + \ ]) diff --git a/test/handler/test_redpen_handler.vader b/test/handler/test_redpen_handler.vader index 4490bcba..0b030e2d 100644 --- a/test/handler/test_redpen_handler.vader +++ b/test/handler/test_redpen_handler.vader @@ -80,7 +80,7 @@ Execute(redpen handler should handle errors output): \ ']', \ ]) -Execute(redpen handler should no error output): +Execute(The redpen handler should handle an empty error list): AssertEqual \ [], \ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), [ @@ -91,3 +91,8 @@ Execute(redpen handler should no error output): \ ' }', \ ']', \ ]) + +Execute(The redpen handler should handle totally empty output): + AssertEqual + \ [], + \ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), []) diff --git a/test/handler/test_rubocop_handler.vader b/test/handler/test_rubocop_handler.vader index ef0137d6..d7868f26 100644 --- a/test/handler/test_rubocop_handler.vader +++ b/test/handler/test_rubocop_handler.vader @@ -41,21 +41,21 @@ Execute(The rubocop handler should parse lines correctly): \ 'type': 'E', \ }, \ ], - \ ale_linters#ruby#rubocop#Handle(347, [ + \ ale#ruby#HandleRubocopOutput(347, [ \ '{"metadata":{"rubocop_version":"0.47.1","ruby_engine":"ruby","ruby_version":"2.1.5","ruby_patchlevel":"273","ruby_platform":"x86_64-linux-gnu"},"files":[{"path":"my_great_file.rb","offenses":[{"severity":"convention","message":"Prefer single-quoted strings...","cop_name":"Style/SomeCop","corrected":false,"location":{"line":83,"column":29,"length":7}},{"severity":"fatal","message":"Some error","cop_name":"Style/SomeOtherCop","corrected":false,"location":{"line":12,"column":2,"length":1}},{"severity":"warning","message":"Regular warning","cop_name":"Style/WarningCop","corrected":false,"location":{"line":10,"column":5,"length":8}},{"severity":"error","message":"Another error","cop_name":"Style/SpaceBeforeBlockBraces","corrected":false,"location":{"line":11,"column":1,"length":1}}]}],"summary":{"offense_count":4,"target_file_count":1,"inspected_file_count":1}}' \ ]) Execute(The rubocop handler should handle when files are checked and no offenses are found): AssertEqual \ [], - \ ale_linters#ruby#rubocop#Handle(347, [ + \ ale#ruby#HandleRubocopOutput(347, [ \ '{"metadata":{"rubocop_version":"0.47.1","ruby_engine":"ruby","ruby_version":"2.1.5","ruby_patchlevel":"273","ruby_platform":"x86_64-linux-gnu"},"files":[{"path":"my_great_file.rb","offenses":[]}],"summary":{"offense_count":0,"target_file_count":1,"inspected_file_count":1}}' \ ]) Execute(The rubocop handler should handle when no files are checked): AssertEqual \ [], - \ ale_linters#ruby#rubocop#Handle(347, [ + \ ale#ruby#HandleRubocopOutput(347, [ \ '{"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}}' \ ]) @@ -66,11 +66,11 @@ Execute(The rubocop handler should handle output without any errors): AssertEqual \ [], - \ ale_linters#ruby#rubocop#Handle(347, g:lines) + \ ale#ruby#HandleRubocopOutput(347, g:lines) \ AssertEqual \ [], - \ ale_linters#ruby#rubocop#Handle(347, ['{}']) + \ ale#ruby#HandleRubocopOutput(347, ['{}']) AssertEqual \ [], - \ ale_linters#ruby#rubocop#Handle(347, []) + \ ale#ruby#HandleRubocopOutput(347, []) diff --git a/test/handler/test_rust_handler.vader b/test/handler/test_rust_handler.vader index 4764e713..56db9b36 100644 --- a/test/handler/test_rust_handler.vader +++ b/test/handler/test_rust_handler.vader @@ -8,7 +8,7 @@ Execute(The Rust handler should handle rustc output): \ 'end_lnum': 15, \ 'type': 'E', \ 'col': 5, - \ 'end_col': 8, + \ 'end_col': 7, \ 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`', \ }, \ { @@ -16,7 +16,7 @@ Execute(The Rust handler should handle rustc output): \ 'end_lnum': 13, \ 'type': 'E', \ 'col': 7, - \ 'end_col': 10, + \ 'end_col': 9, \ 'text': 'no method named `wat` found for type `std::string::String` in the current scope', \ }, \ ], @@ -84,7 +84,7 @@ Execute(The Rust handler should handle cargo output): \ 'end_lnum': 15, \ 'type': 'E', \ 'col': 5, - \ 'end_col': 8, + \ 'end_col': 7, \ 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`', \ }, \ { @@ -92,7 +92,7 @@ Execute(The Rust handler should handle cargo output): \ 'end_lnum': 13, \ 'type': 'E', \ 'col': 7, - \ 'end_col': 10, + \ 'end_col': 9, \ 'text': 'no method named `wat` found for type `std::string::String` in the current scope', \ }, \ ], @@ -158,7 +158,7 @@ Execute(The Rust handler should should errors from expansion spans): \ 'end_lnum': 4, \ 'type': 'E', \ 'col': 21, - \ 'end_col': 23, + \ 'end_col': 22, \ 'text': 'mismatched types: expected bool, found integral variable', \ }, \ ], @@ -208,7 +208,7 @@ Execute(The Rust handler should show detailed errors): \ 'end_lnum': 4, \ 'type': 'E', \ 'col': 21, - \ 'end_col': 23, + \ 'end_col': 22, \ 'text': 'mismatched types: expected bool, found integral variable', \ }, \ ], @@ -296,7 +296,7 @@ Execute(The Rust handler should remove secondary spans if set): \ 'lnum': 1, \ 'end_lnum': 1, \ 'type': 'E', - \ 'end_col': 21, + \ 'end_col': 20, \ 'col': 1, \ 'text': 'this function takes 1 parameter but 0 were supplied: defined here', \ }, @@ -304,7 +304,7 @@ Execute(The Rust handler should remove secondary spans if set): \ 'lnum': 1, \ 'end_lnum': 1, \ 'type': 'E', - \ 'end_col': 46, + \ 'end_col': 45, \ 'col': 40, \ 'text': 'this function takes 1 parameter but 0 were supplied: expected 1 parameter', \ }, @@ -371,7 +371,7 @@ Execute(The Rust handler should remove secondary spans if set): \ 'lnum': 1, \ 'end_lnum': 1, \ 'type': 'E', - \ 'end_col': 46, + \ 'end_col': 45, \ 'col': 40, \ 'text': 'this function takes 1 parameter but 0 were supplied: expected 1 parameter', \ }, diff --git a/test/handler/test_vcom_handler.vader b/test/handler/test_vcom_handler.vader new file mode 100644 index 00000000..943b525a --- /dev/null +++ b/test/handler/test_vcom_handler.vader @@ -0,0 +1,36 @@ +Before: + runtime ale_linters/vhdl/vcom.vim + +After: + call ale#linter#Reset() + +Execute(The vcom handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 218, + \ 'type': 'W', + \ 'text': '(vcom-1236) Shared variables must be of a protected type.' + \ }, + \ { + \ 'lnum': 73, + \ 'type': 'E', + \ 'text': '(vcom-1136) Unknown identifier "aresetn".' + \ }, + \ { + \ 'lnum': 73, + \ 'type': 'E', + \ 'text': 'Bad resolution function (STD_LOGIC) for type (error).' + \ }, + \ { + \ 'lnum': 73, + \ 'type': 'E', + \ 'text': 'near ":": (vcom-1576) expecting ";" or ")".' + \ }, + \ ], + \ ale_linters#vhdl#vcom#Handle(bufnr(''), [ + \ '** Warning: ../path/to/file.vhd(218): (vcom-1236) Shared variables must be of a protected type.', + \ '** Error: tb_file.vhd(73): (vcom-1136) Unknown identifier "aresetn".', + \ '** Error: tb_file.vhd(73): Bad resolution function (STD_LOGIC) for type (error).', + \ '** Error: tb_file.vhd(73): near ":": (vcom-1576) expecting ";" or ")".', + \ ]) diff --git a/test/handler/test_vlog_handler.vader b/test/handler/test_vlog_handler.vader new file mode 100644 index 00000000..a70665db --- /dev/null +++ b/test/handler/test_vlog_handler.vader @@ -0,0 +1,24 @@ +Before: + runtime ale_linters/verilog/vlog.vim + +After: + call ale#linter#Reset() + +Execute(The vlog handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 7, + \ 'type': 'W', + \ 'text': '(vlog-2623) Undefined variable: C.' + \ }, + \ { + \ 'lnum': 1, + \ 'type': 'E', + \ 'text': '(vlog-13294) Identifier must be declared with a port mode: C.' + \ }, + \ ], + \ ale_linters#verilog#vlog#Handle(bufnr(''), [ + \ '** Warning: add.v(7): (vlog-2623) Undefined variable: C.', + \ '** Error: file.v(1): (vlog-13294) Identifier must be declared with a port mode: C.', + \ ]) diff --git a/test/handler/test_vulture_handler.vader b/test/handler/test_vulture_handler.vader index c6bd7643..b28055db 100644 --- a/test/handler/test_vulture_handler.vader +++ b/test/handler/test_vulture_handler.vader @@ -70,7 +70,7 @@ Execute(Vulture exception should be handled): \ [ \ { \ 'lnum': 1, - \ 'text': 'An exception was thrown. See :ALEDetail', + \ 'text': 'BaddestException: Everything gone wrong (See :ALEDetail)', \ 'detail': join([ \ 'Traceback (most recent call last):', \ ' File "/usr/lib/python3.6/site-packages/vulture/__init__.py", line 13, in <module>', diff --git a/test/handler/test_xvhdl_handler.vader b/test/handler/test_xvhdl_handler.vader new file mode 100644 index 00000000..b90539b8 --- /dev/null +++ b/test/handler/test_xvhdl_handler.vader @@ -0,0 +1,24 @@ +Before: + runtime ale_linters/vhdl/xvhdl.vim + +After: + call ale#linter#Reset() + +Execute(The xvhdl handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 17, + \ 'type': 'E', + \ 'text': '[VRFC 10-91] aresetn is not declared ' + \ }, + \ { + \ 'lnum': 128, + \ 'type': 'E', + \ 'text': '[VRFC 10-91] m_axis_tx_tdata is not declared ' + \ }, + \ ], + \ ale_linters#vhdl#xvhdl#Handle(bufnr(''), [ + \ 'ERROR: [VRFC 10-91] aresetn is not declared [/path/to/file.vhd:17]', + \ 'ERROR: [VRFC 10-91] m_axis_tx_tdata is not declared [/home/user/tx_data.vhd:128]', + \ ]) diff --git a/test/handler/test_xvlog_handler.vader b/test/handler/test_xvlog_handler.vader new file mode 100644 index 00000000..2e1f83fc --- /dev/null +++ b/test/handler/test_xvlog_handler.vader @@ -0,0 +1,18 @@ +Before: + runtime ale_linters/verilog/xvlog.vim + +After: + call ale#linter#Reset() + +Execute(The xvlog handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 5, + \ 'type': 'E', + \ 'text': '[VRFC 10-1412] syntax error near output ' + \ }, + \ ], + \ ale_linters#verilog#xvlog#Handle(bufnr(''), [ + \ 'ERROR: [VRFC 10-1412] syntax error near output [/path/to/file.v:5]', + \ ]) |