]> git.madduck.net Git - etc/vim.git/blob - test/linter/test_erlang_erlc.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / test / linter / test_erlang_erlc.vader
1 Before:
2   call ale#assert#SetUpLinterTest('erlang', 'erlc')
3
4 After:
5   call ale#assert#TearDownLinterTest()
6
7 Execute(The default command should be correct.):
8     let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr(''))
9     let g:regex = 'erlc.\+-o.\+%t'
10     let g:matched = match(g:cmd, g:regex)
11
12     " match returns -1 if not found
13     AssertNotEqual
14     \   g:matched,
15     \   -1,
16     \   'Command error: expected [' . g:cmd . '] to match [' . g:regex . ']'
17
18 Execute(The command should accept configured executable.):
19     let b:ale_erlang_erlc_executable = '/usr/bin/erlc'
20     let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr(''))
21     let g:regex = '/usr/bin/erlc.\+-o.\+%t'
22     let g:matched = match(g:cmd, g:regex)
23
24     " match returns -1 if not found
25     AssertNotEqual
26     \   g:matched,
27     \   -1,
28     \   'Command error: expected [' . g:cmd . '] to match [' . g:regex . ']'
29
30 Execute(The command should accept configured options.):
31     let b:ale_erlang_erlc_options = '-I include'
32     let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr(''))
33     let g:regex = 'erlc.\+-o.\+-I include.\+%t'
34     let g:matched = match(g:cmd, g:regex)
35
36     " match returns -1 if not found
37     AssertNotEqual
38     \   g:matched,
39     \   -1,
40     \   'Command error: expected [' . g:cmd . '] to match [' . g:regex . ']'
41
42 Execute(Linter should recognize OTP23 format.):
43     let g:lines = ["t.erl:6: only association operators '=>' are allowed in map construction"]
44     let g:output_text = ale_linters#erlang#erlc#Handle(bufnr(''), g:lines)[0].text
45
46     let g:expected = "only association operators '=>' are allowed in map construction"
47     AssertEqual
48     \   g:output_text,
49     \   g:expected,
50     \   'Command error: expected [' . g:output_text . '] to match [' . g:expected . ']'
51
52 Execute(Linter should recognize OTP24 format.):
53     let g:lines = ["t.erl:6:16: only association operators '=>' are allowed in map construction",
54     \              "%    6|   #{ a => A, b := B }.",
55     \              "%     |                ^"]
56     let g:output_text = ale_linters#erlang#erlc#Handle(bufnr(''), g:lines)[0].text
57
58     let g:expected = "only association operators '=>' are allowed in map construction"
59     AssertEqual
60     \   g:output_text,
61     \   g:expected,
62     \   'Command error: expected [' . g:output_text . '] to match [' . g:expected . ']'