diff src/testdir/test_channel.vim @ 8094:18a3f0f05244 v7.4.1341

commit https://github.com/vim/vim/commit/910b8aac5dc4693c4508b7acd2cef0bbfac04242 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 16 21:03:07 2016 +0100 patch 7.4.1341 Problem: It's difficult to add more arguments to ch_sendraw() and ch_sendexpr(). Solution: Make the third option a dictionary.
author Christian Brabandt <cb@256bit.org>
date Tue, 16 Feb 2016 21:15:05 +0100
parents 3ea56a74077f
children 882ba5080c5c
line wrap: on
line diff
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -117,7 +117,7 @@ func s:communicate(port)
   call assert_equal('added more', getline('$'))
 
   " Send a request with a specific handler.
-  call ch_sendexpr(handle, 'hello!', 's:RequestHandler')
+  call ch_sendexpr(handle, 'hello!', {'callback': 's:RequestHandler'})
   sleep 10m
   if !exists('s:responseHandle')
     call assert_false(1, 's:responseHandle was not set')
@@ -128,7 +128,7 @@ func s:communicate(port)
 
   unlet s:responseHandle
   let s:responseMsg = ''
-  call ch_sendexpr(handle, 'hello!', function('s:RequestHandler'))
+  call ch_sendexpr(handle, 'hello!', {'callback': function('s:RequestHandler')})
   sleep 10m
   if !exists('s:responseHandle')
     call assert_false(1, 's:responseHandle was not set')
@@ -171,7 +171,7 @@ func s:communicate(port)
   call assert_equal('ok', ch_sendexpr(handle, 'empty-request'))
 
   " make the server quit, can't check if this works, should not hang.
-  call ch_sendexpr(handle, '!quit!', 0)
+  call ch_sendexpr(handle, '!quit!', {'callback': 0})
 endfunc
 
 func Test_communicate()
@@ -242,7 +242,7 @@ func s:channel_handler(port)
   call assert_equal('we called you', s:reply)
 
   " Test that it works while not waiting on a numbered message.
-  call ch_sendexpr(handle, 'call me again', 0)
+  call ch_sendexpr(handle, 'call me again', {'callback': 0})
   sleep 10m
   call assert_equal('we did call you', s:reply)
 endfunc
@@ -292,11 +292,11 @@ func Test_raw_pipe()
   call assert_equal("run", job_status(job))
   try
     let handle = job_getchannel(job)
-    call ch_sendraw(handle, "echo something\n", 0)
+    call ch_sendraw(handle, "echo something\n", {'callback': 0})
     let msg = ch_readraw(handle)
     call assert_equal("something\n", substitute(msg, "\r", "", 'g'))
 
-    call ch_sendraw(handle, "double this\n", 0)
+    call ch_sendraw(handle, "double this\n", {'callback': 0})
     let msg = ch_readraw(handle)
     call assert_equal("this\nAND this\n", substitute(msg, "\r", "", 'g'))
 
@@ -315,10 +315,10 @@ func Test_nl_pipe()
   call assert_equal("run", job_status(job))
   try
     let handle = job_getchannel(job)
-    call ch_sendraw(handle, "echo something\n", 0)
+    call ch_sendraw(handle, "echo something\n", {'callback': 0})
     call assert_equal("something", ch_readraw(handle))
 
-    call ch_sendraw(handle, "double this\n", 0)
+    call ch_sendraw(handle, "double this\n", {'callback': 0})
     call assert_equal("this", ch_readraw(handle))
     call assert_equal("AND this", ch_readraw(handle))
 
@@ -340,7 +340,7 @@ endfunc
 " Test that "unlet handle" in a handler doesn't crash Vim.
 func s:unlet_handle(port)
   let s:channelfd = ch_open('localhost:' . a:port, s:chopt)
-  call ch_sendexpr(s:channelfd, "test", function('s:UnletHandler'))
+  call ch_sendexpr(s:channelfd, "test", {'callback': function('s:UnletHandler')})
   sleep 10m
   call assert_equal('what?', s:unletResponse)
 endfunc
@@ -360,7 +360,7 @@ endfunc
 " Test that "unlet handle" in a handler doesn't crash Vim.
 func s:close_handle(port)
   let s:channelfd = ch_open('localhost:' . a:port, s:chopt)
-  call ch_sendexpr(s:channelfd, "test", function('s:CloseHandler'))
+  call ch_sendexpr(s:channelfd, "test", {'callback': function('s:CloseHandler')})
   sleep 10m
   call assert_equal('what?', s:unletResponse)
 endfunc