summaryrefslogtreecommitdiff
path: root/test/handler
diff options
context:
space:
mode:
authorHarrison Bachrach <harrison.bachrach@gmail.com>2019-01-27 08:01:42 -0800
committerw0rp <w0rp@users.noreply.github.com>2019-01-27 16:01:42 +0000
commit17a2f554e3b56411aec3f2ae4d3b0f44656870ef (patch)
tree04ed65c2015f8d6f74529e1d7bb6c8e5ee0657cb /test/handler
parent08d3523962927d1360b87ac147a29a242c31e7b0 (diff)
downloadale-17a2f554e3b56411aec3f2ae4d3b0f44656870ef.zip
Add initial ameba (crystal linter) support (#2174)
* Add initial ameba (crystal linter) support Note that this depends on saved file as `ameba` does not have STDIN support * Fix formatting of crystal linter documentation * Add tests for ameba executable customization
Diffstat (limited to 'test/handler')
-rw-r--r--test/handler/test_ameba_handler.vader44
1 files changed, 44 insertions, 0 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, [])