2018-04-28 21:50:20 +00:00
|
|
|
Before:
|
|
|
|
Save g:ale_run_synchronously
|
|
|
|
Save g:ale_buffer_info
|
2018-07-16 23:18:20 +00:00
|
|
|
|
2018-04-28 21:50:20 +00:00
|
|
|
let g:ale_run_synchronously = 1
|
|
|
|
let g:ale_buffer_info = {}
|
|
|
|
|
|
|
|
let g:checking_buffer = 0
|
|
|
|
|
|
|
|
unlet! b:ale_linted
|
|
|
|
|
|
|
|
function! TestCallback(buffer, output)
|
|
|
|
return []
|
|
|
|
endfunction
|
|
|
|
|
2018-07-16 23:18:20 +00:00
|
|
|
call ale#linter#PreventLoading('testft')
|
2018-04-28 21:50:20 +00:00
|
|
|
call ale#linter#Define('testft', {
|
|
|
|
\ 'name': 'testlinter',
|
|
|
|
\ 'callback': 'TestCallback',
|
|
|
|
\ 'executable': has('win32') ? 'cmd' : 'true',
|
|
|
|
\ 'command': 'true',
|
|
|
|
\})
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
|
|
|
unlet! g:checking_buffer
|
2018-07-16 23:18:20 +00:00
|
|
|
|
2018-04-28 21:50:20 +00:00
|
|
|
delfunction TestCallback
|
|
|
|
call ale#linter#Reset()
|
2018-07-16 23:18:20 +00:00
|
|
|
|
2018-04-28 21:50:20 +00:00
|
|
|
augroup VaderTest
|
|
|
|
autocmd!
|
2018-10-29 18:28:28 +00:00
|
|
|
augroup END
|
2018-04-28 21:50:20 +00:00
|
|
|
|
|
|
|
augroup! VaderTest
|
|
|
|
|
2018-07-16 23:18:20 +00:00
|
|
|
Given testft (An empty file):
|
2018-04-28 21:50:20 +00:00
|
|
|
Execute(ALELintPre should not return success on ale#engine#IsCheckingBuffer):
|
|
|
|
augroup VaderTest
|
|
|
|
autocmd!
|
2018-07-16 23:18:20 +00:00
|
|
|
autocmd User ALELintPre let g:checking_buffer = ale#engine#IsCheckingBuffer(bufnr('')) ? 1 : 0
|
2018-10-29 18:28:28 +00:00
|
|
|
augroup END
|
2018-04-28 21:50:20 +00:00
|
|
|
|
2018-07-16 23:18:20 +00:00
|
|
|
ALELint
|
2018-04-28 21:50:20 +00:00
|
|
|
|
|
|
|
AssertEqual g:checking_buffer, 0
|
|
|
|
|
|
|
|
Execute(ALEJobStarted should return success on ale#engine#IsCheckingBuffer):
|
|
|
|
augroup VaderTest
|
|
|
|
autocmd!
|
2018-07-16 23:18:20 +00:00
|
|
|
autocmd User ALEJobStarted let g:checking_buffer = ale#engine#IsCheckingBuffer(bufnr('')) ? 1 : 0
|
2018-10-29 18:28:28 +00:00
|
|
|
augroup END
|
2018-04-28 21:50:20 +00:00
|
|
|
|
2018-07-16 23:18:20 +00:00
|
|
|
ALELint
|
2018-04-28 21:50:20 +00:00
|
|
|
|
|
|
|
AssertEqual g:checking_buffer, 1
|