2019-02-21 21:24:41 +00:00
|
|
|
Before:
|
|
|
|
Save g:ale_run_synchronously
|
|
|
|
Save g:ale_emulate_job_failure
|
|
|
|
Save g:ale_buffer_info
|
|
|
|
|
|
|
|
let g:ale_run_synchronously = 1
|
|
|
|
let g:ale_buffer_info = {}
|
|
|
|
let b:ale_history = []
|
|
|
|
|
|
|
|
call ale#linter#Reset()
|
|
|
|
call ale#assert#SetUpLinterTestCommands()
|
|
|
|
call ale#linter#Define('foobar', {
|
|
|
|
\ 'name': 'lint_file_linter',
|
|
|
|
\ 'callback': 'LintFileCallback',
|
2020-08-28 13:02:05 +00:00
|
|
|
\ 'executable': has('win32') ? 'cmd' : 'echo',
|
2019-02-21 21:24:41 +00:00
|
|
|
\ 'command': {b -> ale#command#Run(b, 'echo', {-> ale#command#Run(b, 'echo', {-> 'foo'})})},
|
|
|
|
\ 'read_buffer': 0,
|
|
|
|
\})
|
|
|
|
|
2019-04-07 13:58:06 +00:00
|
|
|
" Run the test commands in the shell.
|
|
|
|
let g:ale_run_synchronously_emulate_commands = 0
|
|
|
|
|
2019-02-21 21:24:41 +00:00
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
|
|
|
call ale#assert#TearDownLinterTest()
|
2019-04-07 13:58:06 +00:00
|
|
|
unlet! g:ale_run_synchronously_callbacks
|
2019-02-21 21:24:41 +00:00
|
|
|
|
|
|
|
Given foobar (Some imaginary filetype):
|
|
|
|
Execute(It should be possible to compute an executable to check based on the result of commands):
|
2020-08-28 13:02:05 +00:00
|
|
|
AssertLinter has('win32') ? 'cmd' : 'echo', 'foo'
|
2019-02-21 21:24:41 +00:00
|
|
|
|
|
|
|
ALELint
|
|
|
|
call ale#test#FlushJobs()
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 1,
|
|
|
|
\ len(filter(copy(b:ale_history), 'string(v:val.command) =~# ''foo'''))
|
|
|
|
|
|
|
|
Execute(It handle the deferred command failing):
|
|
|
|
let g:ale_emulate_job_failure = 1
|
|
|
|
|
2020-08-28 13:02:05 +00:00
|
|
|
AssertLinter has('win32') ? 'cmd' : 'echo', 0
|
2019-02-21 21:24:41 +00:00
|
|
|
|
|
|
|
ALELint
|
|
|
|
call ale#test#FlushJobs()
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 0,
|
|
|
|
\ len(filter(copy(b:ale_history), 'string(v:val.command) =~# ''foo'''))
|