diff src/testdir/test_channel.vim @ 8798:176647a751d7 v7.4.1687

commit https://github.com/vim/vim/commit/bdf0bda968a53a55149a4c83a10a60c28e431305 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 30 21:06:57 2016 +0200 patch 7.4.1687 Problem: The channel close_cb option does not work. Solution: Use jo_close_partial instead of jo_err_partial. (Damien)
author Christian Brabandt <cb@256bit.org>
date Wed, 30 Mar 2016 22:15:10 +0200
parents f8707ec9efe4
children 03250bc0c63a
line wrap: on
line diff
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -1203,6 +1203,29 @@ func Test_close_callback()
   call s:run_server('s:test_close_callback')
 endfunc
 
+function s:test_close_partial(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
+  let s:d = {}
+  func s:d.closeCb(ch) dict
+    let self.close_ret = 'closed'
+  endfunc
+  call ch_setoptions(handle, {'close_cb': s:d.closeCb})
+
+  call assert_equal('', ch_evalexpr(handle, 'close me'))
+  call s:waitFor('"closed" == s:d.close_ret')
+  call assert_equal('closed', s:d.close_ret)
+  unlet s:d
+endfunc
+
+func Test_close_partial()
+  call ch_log('Test_close_partial()')
+  call s:run_server('s:test_close_partial')
+endfunc
+
 func Test_job_start_invalid()
   call assert_fails('call job_start($x)', 'E474:')
   call assert_fails('call job_start("")', 'E474:')