mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-09 04:52:29 +08:00
Fix #288 - Add a command for running ALE
This commit is contained in:
61
test/test_ale_lint_command.vader
Normal file
61
test/test_ale_lint_command.vader
Normal file
@@ -0,0 +1,61 @@
|
||||
Before:
|
||||
let g:expected_loclist = [{
|
||||
\ 'bufnr': bufnr('%'),
|
||||
\ 'lnum': 2,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 3,
|
||||
\ 'text': 'foo bar',
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ 'pattern': '',
|
||||
\ 'valid': 1,
|
||||
\}]
|
||||
let g:expected_groups = [
|
||||
\ 'ALECleanupGroup',
|
||||
\ 'ALECursorGroup',
|
||||
\ 'ALEHighlightBufferGroup',
|
||||
\ 'ALERunOnEnterGroup',
|
||||
\ 'ALERunOnTextChangedGroup',
|
||||
\]
|
||||
|
||||
function! ToggleTestCallback(buffer, output)
|
||||
return [{
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': 2,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 3,
|
||||
\ 'text': a:output[0],
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\}]
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('foobar', {
|
||||
\ 'name': 'testlinter',
|
||||
\ 'callback': 'ToggleTestCallback',
|
||||
\ 'executable': 'echo',
|
||||
\ 'command': 'echo foo bar',
|
||||
\})
|
||||
|
||||
After:
|
||||
unlet! g:expected_loclist
|
||||
unlet! g:expected_groups
|
||||
|
||||
let g:ale_buffer_info = {}
|
||||
call ale#linter#Reset()
|
||||
|
||||
delfunction ToggleTestCallback
|
||||
|
||||
Given foobar (Some imaginary filetype):
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
|
||||
Execute(ALELint should run the linters):
|
||||
AssertEqual 'foobar', &filetype
|
||||
|
||||
ALELint
|
||||
call ale#engine#WaitForJobs(2000)
|
||||
|
||||
" Check the loclist
|
||||
AssertEqual g:expected_loclist, getloclist(0)
|
||||
Reference in New Issue
Block a user