diff options
author | w0rp <devw0rp@gmail.com> | 2017-05-12 21:16:15 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-05-12 21:16:15 +0100 |
commit | 5a947933d727503482776b9459e8680b7f29324a (patch) | |
tree | 234e9605d49330410151b8a8a6db04163750967f /test | |
parent | 2bafdb7e5a5cb96cb8263ed1b7bb79be021e4350 (diff) | |
download | ale-5a947933d727503482776b9459e8680b7f29324a.zip |
Refactor jobs into a Vim version agnostic API which can be used for other purposes
Diffstat (limited to 'test')
-rw-r--r-- | test/smoke_test.vader | 3 | ||||
-rw-r--r-- | test/test_ale_toggle.vader | 5 | ||||
-rw-r--r-- | test/test_command_chain.vader | 7 | ||||
-rw-r--r-- | test/test_history_saving.vader | 8 | ||||
-rw-r--r-- | test/test_line_join.vader | 2 | ||||
-rw-r--r-- | test/test_vim8_processid_parsing.vader | 8 |
6 files changed, 15 insertions, 18 deletions
diff --git a/test/smoke_test.vader b/test/smoke_test.vader index 18b74cf0..30f32534 100644 --- a/test/smoke_test.vader +++ b/test/smoke_test.vader @@ -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: diff --git a/test/test_ale_toggle.vader b/test/test_ale_toggle.vader index cbb31857..5d27c864 100644 --- a/test/test_ale_toggle.vader +++ b/test/test_ale_toggle.vader @@ -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: diff --git a/test/test_command_chain.vader b/test/test_command_chain.vader index 7b5e83ca..16472041 100644 --- a/test/test_command_chain.vader +++ b/test/test_command_chain.vader @@ -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' diff --git a/test/test_history_saving.vader b/test/test_history_saving.vader index b6c75972..2f1044d7 100644 --- a/test/test_history_saving.vader +++ b/test/test_history_saving.vader @@ -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. diff --git a/test/test_line_join.vader b/test/test_line_join.vader index 26abb7c9..63d8d338 100644 --- a/test/test_line_join.vader +++ b/test/test_line_join.vader @@ -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 diff --git a/test/test_vim8_processid_parsing.vader b/test/test_vim8_processid_parsing.vader index 5ec564e0..26416b15 100644 --- a/test/test_vim8_processid_parsing.vader +++ b/test/test_vim8_processid_parsing.vader @@ -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') |