mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 7.4.1627
Problem: Channel out_cb and err_cb are not tested. Solution: Add a test.
This commit is contained in:
@@ -994,6 +994,39 @@ func Test_reuse_channel()
|
|||||||
endtry
|
endtry
|
||||||
endfunc
|
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 = ''
|
let s:unletResponse = ''
|
||||||
|
@@ -748,6 +748,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1627,
|
||||||
/**/
|
/**/
|
||||||
1626,
|
1626,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user