diff options
author | w0rp <devw0rp@gmail.com> | 2017-07-27 00:45:25 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-07-27 00:45:25 +0100 |
commit | fa33faad9ed6da220394bd2abec2e1bdcd19edba (patch) | |
tree | 288fa6a1f8d2231d3e7b3b8e2915730906d6920e /test/handler/test_reek_handler.vader | |
parent | db4d68eae75c071b2a6521fe8587102f5b781efe (diff) | |
download | ale-fa33faad9ed6da220394bd2abec2e1bdcd19edba.zip |
#810 - Handle output which is not JSON in many linters
Diffstat (limited to 'test/handler/test_reek_handler.vader')
-rw-r--r-- | test/handler/test_reek_handler.vader | 115 |
1 files changed, 61 insertions, 54 deletions
diff --git a/test/handler/test_reek_handler.vader b/test/handler/test_reek_handler.vader index 67ba6f60..6861428c 100644 --- a/test/handler/test_reek_handler.vader +++ b/test/handler/test_reek_handler.vader @@ -2,68 +2,75 @@ Before: runtime ale_linters/ruby/reek.vim After: - call ale#linter#Reset() + 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 + let g:ale_ruby_reek_show_context = 1 + let g:ale_ruby_reek_show_wiki_link = 0 - AssertEqual - \ [ - \ { - \ 'lnum': 12, - \ 'text': 'Rule1: Context#method violates rule number one', - \ 'type': 'W', - \ }, - \ { - \ 'lnum': 34, - \ 'text': 'Rule2: Context#method violates rule number two', - \ 'type': 'W', - \ }, - \ { - \ 'lnum': 56, - \ 'text': 'Rule2: Context#method violates rule number two', - \ 'type': 'W', - \ }, - \ ], - \ ale_linters#ruby#reek#Handle(347, [ - \ '[{"context":"Context#method","lines":[12],"message":"violates rule number one","smell_type":"Rule1","source":"/home/user/file.rb","parameter":"bad parameter","wiki_link":"https://example.com/Rule1.md"},{"context":"Context#method","lines":[34, 56],"message":"violates rule number two","smell_type":"Rule2","source":"/home/user/file.rb","name":"bad code","count":2,"wiki_link":"https://example.com/Rule1.md"}]' - \ ]) + AssertEqual + \ [ + \ { + \ 'lnum': 12, + \ 'text': 'Rule1: Context#method violates rule number one', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 34, + \ 'text': 'Rule2: Context#method violates rule number two', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 56, + \ 'text': 'Rule2: Context#method violates rule number two', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#ruby#reek#Handle(347, [ + \ '[{"context":"Context#method","lines":[12],"message":"violates rule number one","smell_type":"Rule1","source":"/home/user/file.rb","parameter":"bad parameter","wiki_link":"https://example.com/Rule1.md"},{"context":"Context#method","lines":[34, 56],"message":"violates rule number two","smell_type":"Rule2","source":"/home/user/file.rb","name":"bad code","count":2,"wiki_link":"https://example.com/Rule1.md"}]' + \ ]) 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 + let g:ale_ruby_reek_show_context = 0 + let g:ale_ruby_reek_show_wiki_link = 0 - AssertEqual - \ [ - \ { - \ 'lnum': 12, - \ 'text': 'Rule1: violates rule number one', - \ 'type': 'W', - \ }, - \ ], - \ ale_linters#ruby#reek#Handle(347, [ - \ '[{"context":"Context#method","lines":[12],"message":"violates rule number one","smell_type":"Rule1","source":"/home/user/file.rb","parameter":"bad parameter","wiki_link":"https://example.com/Rule1.md"}]' - \ ]) + AssertEqual + \ [ + \ { + \ 'lnum': 12, + \ 'text': 'Rule1: violates rule number one', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#ruby#reek#Handle(347, [ + \ '[{"context":"Context#method","lines":[12],"message":"violates rule number one","smell_type":"Rule1","source":"/home/user/file.rb","parameter":"bad parameter","wiki_link":"https://example.com/Rule1.md"}]' + \ ]) Execute(The reek handler should parse JSON correctly, with both context and wiki links): - let g:ale_ruby_reek_show_context = 1 - let g:ale_ruby_reek_show_wiki_link = 1 + let g:ale_ruby_reek_show_context = 1 + let g:ale_ruby_reek_show_wiki_link = 1 - AssertEqual - \ [ - \ { - \ 'lnum': 12, - \ 'text': 'Rule1: Context#method violates rule number one [https://example.com/Rule1.md]', - \ 'type': 'W', - \ }, - \ ], - \ ale_linters#ruby#reek#Handle(347, [ - \ '[{"context":"Context#method","lines":[12],"message":"violates rule number one","smell_type":"Rule1","source":"/home/user/file.rb","parameter":"bad parameter","wiki_link":"https://example.com/Rule1.md"}]' - \ ]) + AssertEqual + \ [ + \ { + \ 'lnum': 12, + \ 'text': 'Rule1: Context#method violates rule number one [https://example.com/Rule1.md]', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#ruby#reek#Handle(347, [ + \ '[{"context":"Context#method","lines":[12],"message":"violates rule number one","smell_type":"Rule1","source":"/home/user/file.rb","parameter":"bad parameter","wiki_link":"https://example.com/Rule1.md"}]' + \ ]) Execute(The reek handler should parse JSON correctly when there is no output from reek): - AssertEqual - \ [], - \ ale_linters#ruby#reek#Handle(347, [ - \ ]) + AssertEqual + \ [], + \ ale_linters#ruby#reek#Handle(347, [ + \ ]) + +Execute(The reek handler should handle garbage output): + AssertEqual + \ [], + \ ale_linters#ruby#reek#Handle(347, [ + \ 'No such command in 2.4.1 of ruby', + \ ]) |