# HG changeset patch # User Christian Brabandt # Date 1458509405 -3600 # Node ID 289765409225166a3adcd0878b5199de1c36a61d # Parent 114f60aadff68abe50dbdf1c7978babebe93190e commit https://github.com/vim/vim/commit/75f7265dd402665b8600fdf21ba33f19db06ac0d Author: Bram Moolenaar Date: Sun Mar 20 22:16:56 2016 +0100 patch 7.4.1627 Problem: Channel out_cb and err_cb are not tested. Solution: Add a test. diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim --- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -994,6 +994,39 @@ func Test_reuse_channel() endtry endfunc +func Test_out_cb() + if !has('job') + return + endif + call ch_log('Test_out_cb()') + + let dict = {'thisis': 'dict: '} + func dict.outHandler(chan, msg) dict + let s:outmsg = self.thisis . a:msg + endfunc + func dict.errHandler(chan, msg) dict + let s:errmsg = self.thisis . a:msg + endfunc + let job = job_start(s:python . " test_channel_pipe.py", + \ {'out_cb': dict.outHandler, + \ 'out_mode': 'json', + \ 'err_cb': dict.errHandler, + \ 'err_mode': 'json'}) + call assert_equal("run", job_status(job)) + try + let s:outmsg = '' + let s:errmsg = '' + call ch_sendraw(job, "echo [0, \"hello\"]\n") + call ch_sendraw(job, "echoerr [0, \"there\"]\n") + call s:waitFor('s:outmsg != ""') + call assert_equal("dict: hello", s:outmsg) + call s:waitFor('s:errmsg != ""') + call assert_equal("dict: there", s:errmsg) + finally + call job_stop(job) + endtry +endfunc + """""""""" let s:unletResponse = '' diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -749,6 +749,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1627, +/**/ 1626, /**/ 1625,