mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-10 05:22:31 +08:00
Refactor jobs into a Vim version agnostic API which can be used for other purposes
This commit is contained in:
@@ -11,11 +11,12 @@ Before:
|
||||
\}]
|
||||
endfunction
|
||||
|
||||
" Running the command in another subshell seems to help here.
|
||||
call ale#linter#Define('foobar', {
|
||||
\ 'name': 'testlinter',
|
||||
\ 'callback': 'TestCallback',
|
||||
\ 'executable': 'echo',
|
||||
\ 'command': 'echo foo bar',
|
||||
\ 'command': '/bin/sh -c ''echo foo bar''',
|
||||
\})
|
||||
|
||||
After:
|
||||
|
||||
@@ -26,7 +26,7 @@ Before:
|
||||
\ 'lnum': 2,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 3,
|
||||
\ 'text': a:output[0],
|
||||
\ 'text': 'foo bar',
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\}]
|
||||
@@ -56,7 +56,8 @@ Before:
|
||||
\ 'name': 'testlinter',
|
||||
\ 'callback': 'ToggleTestCallback',
|
||||
\ 'executable': 'echo',
|
||||
\ 'command': 'echo foo bar',
|
||||
\ 'command': 'echo',
|
||||
\ 'read_buffer': 0,
|
||||
\})
|
||||
|
||||
After:
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
Before:
|
||||
Save &shell, g:ale_run_synchronously
|
||||
let g:ale_run_synchronously = 1
|
||||
set shell=/bin/sh
|
||||
let g:linter_output = []
|
||||
let g:first_echo_called = 0
|
||||
let g:second_echo_called = 0
|
||||
@@ -39,6 +42,7 @@ Before:
|
||||
\})
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! g:first_echo_called
|
||||
unlet! g:second_echo_called
|
||||
unlet! g:final_callback_called
|
||||
@@ -55,9 +59,6 @@ Given foobar (Some imaginary filetype):
|
||||
Execute(Check the results of running the chain):
|
||||
AssertEqual 'foobar', &filetype
|
||||
call ale#Lint()
|
||||
" Sleep a little. This allows the commands to complete a little better.
|
||||
sleep 50m
|
||||
call ale#engine#WaitForJobs(2000)
|
||||
|
||||
Assert g:first_echo_called, 'The first chain item was not called'
|
||||
Assert g:second_echo_called, 'The second chain item was not called'
|
||||
|
||||
@@ -44,13 +44,7 @@ Execute(History should be set when commands are run):
|
||||
|
||||
AssertEqual 1, len(g:history)
|
||||
AssertEqual sort(['status', 'exit_code', 'job_id', 'command']), sort(keys(g:history[0]))
|
||||
|
||||
if has('nvim')
|
||||
AssertEqual 'echo command history test', g:history[0].command
|
||||
else
|
||||
AssertEqual ['/bin/sh', '-c', 'echo command history test'], g:history[0].command
|
||||
endif
|
||||
|
||||
AssertEqual ['/bin/sh', '-c', 'echo command history test'], g:history[0].command
|
||||
AssertEqual 'finished', g:history[0].status
|
||||
AssertEqual 0, g:history[0].exit_code
|
||||
" The Job ID will change each time, but we can check the type.
|
||||
|
||||
@@ -18,6 +18,6 @@ After:
|
||||
Execute (Join the lines):
|
||||
let joined_result = []
|
||||
for item in g:test_output
|
||||
call ale#engine#JoinNeovimOutput(joined_result, item)
|
||||
call ale#job#JoinNeovimOutput(joined_result, item)
|
||||
endfor
|
||||
AssertEqual g:expected_result, joined_result
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Execute(Vim8 Process ID parsing should work):
|
||||
AssertEqual 123, ale#engine#ParseVim8ProcessID('process 123 run')
|
||||
AssertEqual 347, ale#engine#ParseVim8ProcessID('process 347 failed')
|
||||
AssertEqual 789, ale#engine#ParseVim8ProcessID('process 789 dead')
|
||||
AssertEqual 0, ale#engine#ParseVim8ProcessID('no process')
|
||||
AssertEqual 123, ale#job#ParseVim8ProcessID('process 123 run')
|
||||
AssertEqual 347, ale#job#ParseVim8ProcessID('process 347 failed')
|
||||
AssertEqual 789, ale#job#ParseVim8ProcessID('process 789 dead')
|
||||
AssertEqual 0, ale#job#ParseVim8ProcessID('no process')
|
||||
|
||||
Reference in New Issue
Block a user