Mercurial > vim
diff src/testdir/test_channel.vim @ 7933:1f0743f4f88f v7.4.1262
commit https://github.com/vim/vim/commit/a07fec9c85d062acd9dd433a2e681770f459ba47
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 5 21:04:08 2016 +0100
patch 7.4.1262
Problem: The channel callback is not invoked.
Solution: Make a list of pending callbacks.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 05 Feb 2016 21:15:04 +0100 |
parents | e44240b5a6da |
children | 3f2e0b62003d |
line wrap: on
line diff
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -69,6 +69,13 @@ func s:kill_server() endif endfunc +let s:responseHandle = -1 +let s:responseMsg = '' +func s:RequestHandler(handle, msg) + let s:responseHandle = a:handle + let s:responseMsg = a:msg +endfunc + func Test_communicate() let handle = s:start_server() if handle < 0 @@ -86,6 +93,12 @@ func Test_communicate() call assert_equal('added1', getline(line('$') - 1)) call assert_equal('added2', getline('$')) + " Send a request with a specific handler. + call ch_sendexpr(handle, 'hello!', 's:RequestHandler') + sleep 10m + call assert_equal(handle, s:responseHandle) + call assert_equal('got it', s:responseMsg) + " Send an eval request that works. call assert_equal('ok', ch_sendexpr(handle, 'eval-works')) sleep 10m