Mercurial > vim
diff src/testdir/test_channel.vim @ 8157:74b44d06d3c7 v7.4.1372
commit https://github.com/vim/vim/commit/6f3a544228c1faf92211cbaf8bbedb1dff883f90
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 20 19:56:13 2016 +0100
patch 7.4.1372
Problem: channel read implementation is incomplete.
Solution: Add ch_read() and options for ch_readraw().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 20 Feb 2016 20:00:05 +0100 |
parents | f96536c291d8 |
children | d0958e22d9ff |
line wrap: on
line diff
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -184,6 +184,21 @@ func s:communicate(port) call assert_equal('ok', ch_sendexpr(handle, 'empty-request')) + " Reading while there is nothing available. + call assert_equal(v:none, ch_read(handle, {'timeout': 0})) + let start = reltime() + call assert_equal(v:none, ch_read(handle, {'timeout': 333})) + let elapsed = reltime(start) + call assert_true(reltimefloat(elapsed) > 0.3) + call assert_true(reltimefloat(elapsed) < 0.6) + + " Send without waiting for a response, then wait for a response. + call ch_sendexpr(handle, 'wait a bit', {'callback': 0}) + let resp = ch_read(handle) + call assert_equal(type([]), type(resp)) + call assert_equal(type(11), type(resp[0])) + call assert_equal('waited', resp[1]) + " make the server quit, can't check if this works, should not hang. call ch_sendexpr(handle, '!quit!', {'callback': 0}) endfunc @@ -292,8 +307,7 @@ func Test_connect_waittime() " Oops, port does exists. call ch_close(handle) else - " Failed connection doesn't wait the full time on Unix. - " TODO: why is MS-Windows different? + " Failed connection should wait about 500 msec. let elapsed = reltime(start) call assert_true(reltimefloat(elapsed) < 1.0) endif