diff src/testdir/test_channel.vim @ 8222:4f0677020a43 v7.4.1404

commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 23 19:34:01 2016 +0100 patch 7.4.1404 Problem: ch_read() doesn't time out on MS-Windows. Solution: Instead of WM_NETBEANS use select(). (Yukihiro Nakadaira)
author Christian Brabandt <cb@256bit.org>
date Tue, 23 Feb 2016 19:45:05 +0100
parents b717dae2f26d
children e05e28dcb590
line wrap: on
line diff
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -131,10 +131,10 @@ func s:communicate(port)
     call assert_false(1, 's:responseHandle was not set')
   else
     call assert_equal(handle, s:responseHandle)
+    unlet s:responseHandle
   endif
   call assert_equal('got it', s:responseMsg)
 
-  unlet s:responseHandle
   let s:responseMsg = ''
   call ch_sendexpr(handle, 'hello!', {'callback': function('s:RequestHandler')})
   sleep 10m
@@ -142,6 +142,7 @@ func s:communicate(port)
     call assert_false(1, 's:responseHandle was not set')
   else
     call assert_equal(handle, s:responseHandle)
+    unlet s:responseHandle
   endif
   call assert_equal('got it', s:responseMsg)
 
@@ -186,15 +187,12 @@ func s:communicate(port)
   call assert_equal('ok', ch_sendexpr(handle, 'empty-request'))
 
   " Reading while there is nothing available.
-  " TODO: make this work for MS-Windows
-  if has('unix')
-    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)
-  endif
+  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})