diff options
author | w0rp <devw0rp@gmail.com> | 2017-02-04 18:30:30 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-02-04 18:30:30 +0000 |
commit | 829f87bc6a63cd442c7e2bf55870faa8804668a4 (patch) | |
tree | 5886ed67def110fb58b1515f03545e8f1c9e15bd /test/test_command_chain.vader | |
parent | 97131262abf31de883bcb65835ed6842f66bbd3b (diff) | |
download | ale-829f87bc6a63cd442c7e2bf55870faa8804668a4.zip |
Fix #124 Finish implementing command chaining, and make it work for DMD
Diffstat (limited to 'test/test_command_chain.vader')
-rw-r--r-- | test/test_command_chain.vader | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/test/test_command_chain.vader b/test/test_command_chain.vader new file mode 100644 index 00000000..f471e159 --- /dev/null +++ b/test/test_command_chain.vader @@ -0,0 +1,61 @@ +Before: + let g:linter_output = [] + let g:first_echo_called = 0 + let g:second_echo_called = 0 + let g:final_callback_called = 0 + + function! CollectResults(buffer, output) + let g:final_callback_called = 1 + let g:linter_output = a:output + return [] + endfunction + function! RunFirstEcho(buffer) + let g:first_echo_called = 1 + + return 'echo foo' + endfunction + function! RunSecondEcho(buffer, output) + let g:second_echo_called = 1 + + return 'echo bar' + endfunction + + call ale#linter#Define('foobar', { + \ 'name': 'testlinter', + \ 'callback': 'CollectResults', + \ 'executable': 'echo', + \ 'command_chain': [ + \ { + \ 'callback': 'RunFirstEcho', + \ 'output_stream': 'stdout', + \ }, + \ { + \ 'callback': 'RunSecondEcho', + \ 'output_stream': 'stdout', + \ }, + \ ], + \}) + +After: + unlet! g:first_echo_called + unlet! g:second_echo_called + unlet! g:final_callback_called + unlet! g:linter_output + let g:ale_buffer_info = {} + call ale#linter#Reset() + delfunction CollectResults + delfunction RunFirstEcho + delfunction RunSecondEcho + +Given foobar (Some imaginary filetype): + anything + +Execute(Check the results of running the chain): + AssertEqual 'foobar', &filetype + call ale#Lint() + 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' + Assert g:final_callback_called, 'The final callback was not called' + AssertEqual ['bar'], g:linter_output |