/ test / test_deferred_executable_string.vader
test_deferred_executable_string.vader
 1  Before:
 2    Save g:ale_run_synchronously
 3    Save g:ale_emulate_job_failure
 4    Save g:ale_buffer_info
 5  
 6    let g:ale_run_synchronously = 1
 7    let g:ale_buffer_info = {}
 8    let b:ale_history = []
 9  
10    call ale#linter#Reset()
11    call ale#assert#SetUpLinterTestCommands()
12    call ale#linter#Define('foobar', {
13    \ 'name': 'lint_file_linter',
14    \ 'callback': 'LintFileCallback',
15    \ 'executable': {b -> ale#command#Run(b, 'echo', {-> ale#command#Run(b, 'echo', {-> 'foo'})})},
16    \ 'command': 'echo',
17    \ 'read_buffer': 0,
18    \})
19  
20  After:
21    Restore
22  
23    call ale#assert#TearDownLinterTest()
24  
25  Given foobar (Some imaginary filetype):
26  Execute(It should be possible to compute an executable to check based on the result of commands):
27    AssertLinter 'foo', 'echo'
28  
29    ALELint
30    call ale#test#FlushJobs()
31  
32    AssertEqual
33    \ [{'status': 0, 'job_id': 'executable', 'command': 'foo'}],
34    \ filter(copy(b:ale_history), 'v:val.job_id is# ''executable''')
35  
36  Execute(We should handle the deferered executable command failing):
37    let g:ale_emulate_job_failure = 1
38  
39    AssertLinter 0, 'echo'
40  
41    ALELint
42    call ale#test#FlushJobs()
43  
44    AssertEqual
45    \ [],
46    \ filter(copy(b:ale_history), 'v:val.job_id is# ''executable''')