Mercurial > vim
diff src/testdir/test_channel.vim @ 8174:f2286ff0c102 v7.4.1380
commit https://github.com/vim/vim/commit/ee1cffc07a42441924c5353af7fd7ab6e97e5aae
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 21 19:14:41 2016 +0100
patch 7.4.1380
Problem: The job exit callback is not implemented.
Solution: Add the "exit-cb" option.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 21 Feb 2016 19:15:04 +0100 |
parents | a0ffb1f3dedc |
children | b717dae2f26d |
line wrap: on
line diff
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -468,3 +468,28 @@ func Test_call() call ch_log('Test_call()') call s:run_server('s:test_call') endfunc + +""""""""" + +let s:job_ret = 'not yet' +function MyExitCb(job, status) + let s:job_ret = 'done' +endfunc + +function s:test_exit_callback(port) + call job_setoptions(s:job, {'exit-cb': 'MyExitCb'}) + let s:exit_job = s:job +endfunc + +func Test_exit_callback() + if has('job') + call s:run_server('s:test_exit_callback') + + " the job may take a little while to exit + sleep 50m + + " calling job_status() triggers the callback + call job_status(s:exit_job) + call assert_equal('done', s:job_ret) + endif +endfunc