Skip to content

Commit 75f7265

Browse files
committed
patch 7.4.1627
Problem: Channel out_cb and err_cb are not tested. Solution: Add a test.
1 parent 580984e commit 75f7265

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

src/testdir/test_channel.vim

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,39 @@ func Test_reuse_channel()
994994
endtry
995995
endfunc
996996

997+
func Test_out_cb()
998+
if !has('job')
999+
return
1000+
endif
1001+
call ch_log('Test_out_cb()')
1002+
1003+
let dict = {'thisis': 'dict: '}
1004+
func dict.outHandler(chan, msg) dict
1005+
let s:outmsg = self.thisis . a:msg
1006+
endfunc
1007+
func dict.errHandler(chan, msg) dict
1008+
let s:errmsg = self.thisis . a:msg
1009+
endfunc
1010+
let job = job_start(s:python . " test_channel_pipe.py",
1011+
\ {'out_cb': dict.outHandler,
1012+
\ 'out_mode': 'json',
1013+
\ 'err_cb': dict.errHandler,
1014+
\ 'err_mode': 'json'})
1015+
call assert_equal("run", job_status(job))
1016+
try
1017+
let s:outmsg = ''
1018+
let s:errmsg = ''
1019+
call ch_sendraw(job, "echo [0, \"hello\"]\n")
1020+
call ch_sendraw(job, "echoerr [0, \"there\"]\n")
1021+
call s:waitFor('s:outmsg != ""')
1022+
call assert_equal("dict: hello", s:outmsg)
1023+
call s:waitFor('s:errmsg != ""')
1024+
call assert_equal("dict: there", s:errmsg)
1025+
finally
1026+
call job_stop(job)
1027+
endtry
1028+
endfunc
1029+
9971030
""""""""""
9981031

9991032
let s:unletResponse = ''

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static char *(features[]) =
748748

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1627,
751753
/**/
752754
1626,
753755
/**/

0 commit comments

Comments
 (0)