diff src/testdir/test_channel.vim @ 10030:3b4b2ac811f0 v7.4.2287

commit https://github.com/vim/vim/commit/6fc8227ebfbdfbbb48b81b679db81f421dbce79b Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 28 19:26:43 2016 +0200 patch 7.4.2287 Problem: The callback passed to ch_sendraw() is not used. Solution: Pass the read part, not the send part. (haya14busa, closes https://github.com/vim/vim/issues/1019)
author Christian Brabandt <cb@256bit.org>
date Sun, 28 Aug 2016 19:30:04 +0200
parents ee8b8a670a5c
children c1ba49441c90
line wrap: on
line diff
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -245,7 +245,6 @@ endfunc
 
 """""""""
 
-let g:Ch_reply = ""
 func Ch_handler(chan, msg)
   unlet g:Ch_reply
   let g:Ch_reply = a:msg
@@ -271,8 +270,10 @@ endfunc
 
 func Test_channel_handler()
   call ch_log('Test_channel_handler()')
+  let g:Ch_reply = ""
   let s:chopt.callback = 'Ch_handler'
   call s:run_server('Ch_channel_handler')
+  let g:Ch_reply = ""
   let s:chopt.callback = function('Ch_handler')
   call s:run_server('Ch_channel_handler')
   unlet s:chopt.callback
@@ -443,6 +444,11 @@ func Test_raw_pipe()
     let msg = ch_readraw(job)
     call assert_equal("this\nAND this\n", substitute(msg, "\r", "", 'g'))
 
+    let g:Ch_reply = ""
+    call ch_sendraw(job, "double this\n", {'callback': 'Ch_handler'})
+    call WaitFor('"" != g:Ch_reply')
+    call assert_equal("this\nAND this\n", substitute(g:Ch_reply, "\r", "", 'g'))
+
     let reply = ch_evalraw(job, "quit\n", {'timeout': 100})
     call assert_equal("Goodbye!\n", substitute(reply, "\r", "", 'g'))
   finally