Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
7932:77f8fc004593 | 7933:1f0743f4f88f |
---|---|
67 else | 67 else |
68 call system("pkill -f test_channel.py") | 68 call system("pkill -f test_channel.py") |
69 endif | 69 endif |
70 endfunc | 70 endfunc |
71 | 71 |
72 let s:responseHandle = -1 | |
73 let s:responseMsg = '' | |
74 func s:RequestHandler(handle, msg) | |
75 let s:responseHandle = a:handle | |
76 let s:responseMsg = a:msg | |
77 endfunc | |
78 | |
72 func Test_communicate() | 79 func Test_communicate() |
73 let handle = s:start_server() | 80 let handle = s:start_server() |
74 if handle < 0 | 81 if handle < 0 |
75 return | 82 return |
76 endif | 83 endif |
83 " tiny bit for the commands to get executed. | 90 " tiny bit for the commands to get executed. |
84 call assert_equal('ok', ch_sendexpr(handle, 'make change')) | 91 call assert_equal('ok', ch_sendexpr(handle, 'make change')) |
85 sleep 10m | 92 sleep 10m |
86 call assert_equal('added1', getline(line('$') - 1)) | 93 call assert_equal('added1', getline(line('$') - 1)) |
87 call assert_equal('added2', getline('$')) | 94 call assert_equal('added2', getline('$')) |
95 | |
96 " Send a request with a specific handler. | |
97 call ch_sendexpr(handle, 'hello!', 's:RequestHandler') | |
98 sleep 10m | |
99 call assert_equal(handle, s:responseHandle) | |
100 call assert_equal('got it', s:responseMsg) | |
88 | 101 |
89 " Send an eval request that works. | 102 " Send an eval request that works. |
90 call assert_equal('ok', ch_sendexpr(handle, 'eval-works')) | 103 call assert_equal('ok', ch_sendexpr(handle, 'eval-works')) |
91 sleep 10m | 104 sleep 10m |
92 call assert_equal([-1, 'foo123'], ch_sendexpr(handle, 'eval-result')) | 105 call assert_equal([-1, 'foo123'], ch_sendexpr(handle, 'eval-result')) |