diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-02-10 21:07:14 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-02-10 21:07:14 +0100 |
commit | f6157284de71d8881f3b89fbd79d1ecbf842929f (patch) | |
tree | 44a698ec890f1b71930999b492865d74670f4c9c /src/testdir/test_channel.py | |
parent | d6a8d48587b2ff43c343fa365898576cc1e235ea (diff) | |
download | vim-git-f6157284de71d8881f3b89fbd79d1ecbf842929f.tar.gz |
patch 7.4.1299v7.4.1299
Problem: When the server sends a message with ID zero the channel handler
is not invoked. (Christian J. Robinson)
Solution: Recognize zero value for the request ID. Add a test for invoking
the channel handler.
Diffstat (limited to 'src/testdir/test_channel.py')
-rw-r--r-- | src/testdir/test_channel.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/testdir/test_channel.py b/src/testdir/test_channel.py index 039a9de91..311fbc07c 100644 --- a/src/testdir/test_channel.py +++ b/src/testdir/test_channel.py @@ -130,6 +130,16 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler): elif decoded[1] == 'eval-result': # Send back the last received eval result. response = last_eval + elif decoded[1] == 'call me': + cmd = '[0,"we called you"]' + print("sending: {}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + elif decoded[1] == 'call me again': + cmd = '[0,"we did call you"]' + print("sending: {}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "" elif decoded[1] == '!quit!': # we're done self.server.shutdown() @@ -140,9 +150,12 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler): else: response = "what?" - encoded = json.dumps([decoded[0], response]) - print("sending: {}".format(encoded)) - self.request.sendall(encoded.encode('utf-8')) + if response == "": + print("no response") + else: + encoded = json.dumps([decoded[0], response]) + print("sending: {}".format(encoded)) + self.request.sendall(encoded.encode('utf-8')) # Negative numbers are used for "eval" responses. elif decoded[0] < 0: |