2017-02-11 18:14:18 +00:00
|
|
|
Before:
|
|
|
|
let g:output = []
|
|
|
|
|
|
|
|
function! TestCallback(buffer, output)
|
|
|
|
let g:output = a:output
|
|
|
|
|
|
|
|
return []
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
call ale#linter#Define('foobar', {
|
|
|
|
\ 'name': 'testlinter',
|
|
|
|
\ 'callback': 'TestCallback',
|
2017-10-23 00:26:31 +00:00
|
|
|
\ 'executable': has('win32') ? 'cmd' : 'cat',
|
|
|
|
\ 'command': has('win32') ? 'type %t' : 'cat %t',
|
2017-02-11 18:14:18 +00:00
|
|
|
\})
|
|
|
|
|
|
|
|
After:
|
|
|
|
unlet! g:output
|
|
|
|
delfunction TestCallback
|
|
|
|
call ale#linter#Reset()
|
|
|
|
|
|
|
|
Given foobar (Some imaginary filetype):
|
|
|
|
foo
|
|
|
|
bar
|
|
|
|
baz
|
|
|
|
|
|
|
|
Execute(ALE should be able to read the %t file):
|
|
|
|
AssertEqual 'foobar', &filetype
|
|
|
|
|
2017-05-06 22:33:38 +00:00
|
|
|
" Sleep a little so the test passes more.
|
|
|
|
sleep 100ms
|
2017-02-11 18:14:18 +00:00
|
|
|
call ale#Lint()
|
|
|
|
call ale#engine#WaitForJobs(2000)
|
|
|
|
|
|
|
|
AssertEqual ['foo', 'bar', 'baz'], g:output
|