diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-02-20 21:39:05 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-02-20 21:39:05 +0100 |
commit | ece61b06ef4726515177c9b293e1c20d2122a73f (patch) | |
tree | e35375890fd94fb5e0ec82e747125f7def355d8d /src/testdir/test_channel.py | |
parent | 6f3a544228c1faf92211cbaf8bbedb1dff883f90 (diff) |
patch 7.4.1373v7.4.1373
Problem: Calling a Vim function over a channel requires turning the
arguments into a string.
Solution: Add the "call" command. (Damien) Also merge "expr" and "eval"
into one.
Diffstat (limited to 'src/testdir/test_channel.py')
-rw-r--r-- | src/testdir/test_channel.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/testdir/test_channel.py b/src/testdir/test_channel.py index 66fd48f43a..26c7dea8d7 100644 --- a/src/testdir/test_channel.py +++ b/src/testdir/test_channel.py @@ -78,26 +78,26 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler): response = "ok" elif decoded[1] == 'eval-works': # Send an eval request. We ignore the response. - cmd = '["eval","\\"foo\\" . 123", -1]' + cmd = '["expr","\\"foo\\" . 123", -1]' print("sending: {}".format(cmd)) self.request.sendall(cmd.encode('utf-8')) response = "ok" elif decoded[1] == 'eval-fails': # Send an eval request that will fail. - cmd = '["eval","xxx", -2]' + cmd = '["expr","xxx", -2]' print("sending: {}".format(cmd)) self.request.sendall(cmd.encode('utf-8')) response = "ok" elif decoded[1] == 'eval-error': # Send an eval request that works but the result can't # be encoded. - cmd = '["eval","function(\\"tr\\")", -3]' + cmd = '["expr","function(\\"tr\\")", -3]' print("sending: {}".format(cmd)) self.request.sendall(cmd.encode('utf-8')) response = "ok" elif decoded[1] == 'eval-bad': # Send an eval request missing the third argument. - cmd = '["eval","xxx"]' + cmd = '["expr","xxx"]' print("sending: {}".format(cmd)) self.request.sendall(cmd.encode('utf-8')) response = "ok" @@ -107,6 +107,11 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler): print("sending: {}".format(cmd)) self.request.sendall(cmd.encode('utf-8')) response = "ok" + elif decoded[1] == 'call-func': + cmd = '["call","MyFunction",[1,2,3], 0]' + print("sending: {}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" elif decoded[1] == 'redraw': cmd = '["redraw",""]' print("sending: {}".format(cmd)) @@ -135,6 +140,9 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler): print("sending: {}".format(cmd)) self.request.sendall(cmd.encode('utf-8')) response = "" + elif decoded[1] == 'wait a bit': + time.sleep(0.2) + response = "waited" elif decoded[1] == '!quit!': # we're done self.server.shutdown() |