To: vim_dev@googlegroups.com Subject: Patch 7.4.1627 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1627 Problem: Channel out_cb and err_cb are not tested. Solution: Add a test. Files: src/testdir/test_channel.vim *** ../vim-7.4.1626/src/testdir/test_channel.vim 2016-03-20 20:56:56.036283020 +0100 --- src/testdir/test_channel.vim 2016-03-20 22:07:11.847162653 +0100 *************** *** 994,999 **** --- 994,1032 ---- 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 = '' *** ../vim-7.4.1626/src/version.c 2016-03-20 21:17:09.103456337 +0100 --- src/version.c 2016-03-20 22:16:31.097151516 +0100 *************** *** 750,751 **** --- 750,753 ---- { /* Add new patch number below this line */ + /**/ + 1627, /**/ -- Momento mori, ergo carpe diem /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///