2017-02-07 17:55:23 -05:00
|
|
|
Before:
|
|
|
|
function! GenerateResults(buffer, output)
|
|
|
|
return [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'col': 1,
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ 'text': 'foo',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 2,
|
|
|
|
\ 'col': 1,
|
|
|
|
\ 'type': 'W',
|
|
|
|
\ 'text': 'bar',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 3,
|
|
|
|
\ 'col': 1,
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ 'text': 'baz',
|
|
|
|
\ },
|
2017-03-11 12:39:51 -05:00
|
|
|
\ {
|
|
|
|
\ 'lnum': 4,
|
|
|
|
\ 'col': 1,
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ 'text': 'use this one',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 4,
|
|
|
|
\ 'col': 2,
|
|
|
|
\ 'type': 'W',
|
|
|
|
\ 'text': 'ignore this one',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 5,
|
|
|
|
\ 'col': 1,
|
|
|
|
\ 'type': 'W',
|
|
|
|
\ 'text': 'ignore this one',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 5,
|
|
|
|
\ 'col': 2,
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ 'text': 'use this one',
|
|
|
|
\ },
|
2017-02-07 17:55:23 -05:00
|
|
|
\]
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
call ale#linter#Define('testft', {
|
|
|
|
\ 'name': 'x',
|
|
|
|
\ 'executable': 'echo',
|
|
|
|
\ 'command': 'echo',
|
|
|
|
\ 'callback': 'GenerateResults',
|
|
|
|
\})
|
|
|
|
|
|
|
|
After:
|
|
|
|
call ale#linter#Reset()
|
|
|
|
delfunction GenerateResults
|
|
|
|
unlet! g:output
|
|
|
|
|
2017-03-09 17:45:22 -05:00
|
|
|
Given testft(A file with warnings/errors):
|
2017-02-07 17:55:23 -05:00
|
|
|
foo
|
|
|
|
bar
|
|
|
|
baz
|
2017-03-11 12:39:51 -05:00
|
|
|
fourth line
|
|
|
|
fifth line
|
2017-02-07 17:55:23 -05:00
|
|
|
|
|
|
|
Execute:
|
|
|
|
call ale#Lint()
|
|
|
|
call ale#engine#WaitForJobs(2000)
|
|
|
|
|
|
|
|
redir => g:output
|
2017-03-11 12:39:51 -05:00
|
|
|
silent sign place
|
2017-02-07 17:55:23 -05:00
|
|
|
redir END
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ ['1', '1000001', 'ALEErrorSign'],
|
|
|
|
\ ['2', '1000002', 'ALEWarningSign'],
|
|
|
|
\ ['3', '1000003', 'ALEErrorSign'],
|
2017-03-11 12:39:51 -05:00
|
|
|
\ ['4', '1000004', 'ALEErrorSign'],
|
|
|
|
\ ['5', '1000005', 'ALEErrorSign'],
|
2017-02-07 17:55:23 -05:00
|
|
|
\ ],
|
|
|
|
\ map(
|
|
|
|
\ split(g:output, '\n')[2:],
|
|
|
|
\ 'matchlist(v:val, "[^=]*=\\(\\d\\+\\)[^=]*=\\(\\d\\+\\).*\\(ALE.*\\)$")[1:3]'
|
|
|
|
\ )
|