Mercurial > vim
diff src/testdir/test_channel.vim @ 8159:d0958e22d9ff v7.4.1373
commit https://github.com/vim/vim/commit/ece61b06ef4726515177c9b293e1c20d2122a73f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 20 21:39:05 2016 +0100
patch 7.4.1373
Problem: Calling a Vim function over a channel requires turning the
arguments into a string.
Solution: Add the "call" command. (Damien) Also merge "expr" and "eval"
into one.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 20 Feb 2016 21:45:04 +0100 |
parents | 74b44d06d3c7 |
children | e9caba58213b |
line wrap: on
line diff
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -431,3 +431,26 @@ func Test_open_delay() " The server will wait half a second before creating the port. call s:run_server('s:open_delay', 'delay') endfunc + +""""""""" + +function MyFunction(a,b,c) + let s:call_ret = [a:a, a:b, a:c] +endfunc + +function s:test_call(port) + let handle = ch_open('localhost:' . a:port, s:chopt) + if ch_status(handle) == "fail" + call assert_false(1, "Can't open channel") + return + endif + + call assert_equal('ok', ch_sendexpr(handle, 'call-func')) + sleep 20m + call assert_equal([1, 2, 3], s:call_ret) +endfunc + +func Test_call() + call ch_log('Test_call()') + call s:run_server('s:test_call') +endfunc