/ test / handler / test_erlang_elvis_handler.vader
test_erlang_elvis_handler.vader
 1  Before:
 2    runtime ale_linters/erlang/elvis.vim
 3  
 4  After:
 5    call ale#linter#Reset()
 6  
 7  Execute(Warning messages should be handled):
 8    AssertEqual
 9    \ [
10    \   {
11    \     'lnum': 11,
12    \     'text': "Replace the 'if' expression on line 11 with a 'case' expression or function clauses.",
13    \     'type': 'W',
14    \     'sub_type': 'style',
15    \   },
16    \   {
17    \     'lnum': 20,
18    \     'text': 'Remove the debug call to io:format/1 on line 20.',
19    \     'type': 'W',
20    \     'sub_type': 'style',
21    \   },
22    \ ],
23    \ ale_linters#erlang#elvis#Handle(bufnr(''), [
24    \   "src/foo.erl:11:no_if_expression:Replace the 'if' expression on line 11 with a 'case' expression or function clauses.",
25    \   'src/foo.erl:20:no_debug_call:Remove the debug call to io:format/1 on line 20.',
26    \ ])
27  
28  Execute(Line length message shouldn't contain the line itself):
29    AssertEqual
30    \ [
31    \   {
32    \     'lnum': 24,
33    \     'text': 'Line 24 is too long.',
34    \     'type': 'W',
35    \     'sub_type': 'style',
36    \   },
37    \ ],
38    \ ale_linters#erlang#elvis#Handle(bufnr(''), [
39    \   'src/foo.erl:24:line_length:Line 24 is too long:     io:format("Look ma, too long!"),.',
40    \ ])