diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-03-20 16:40:37 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-03-20 16:40:37 +0100 |
commit | ba61ac0d61f46de7d29c64bb0de6d25c2e378be0 (patch) | |
tree | 73b207b09bb0d57e5a9cf4f80cd514fbace293fd /src/testdir/test_channel.py | |
parent | ac74d5e86cd16b42e81ba48f58f3d45c72758248 (diff) |
patch 7.4.1617v7.4.1617
Problem: When a JSON message is split it isn't decoded.
Solution: Wait a short time for the rest of the message to arrive.
Diffstat (limited to 'src/testdir/test_channel.py')
-rw-r--r-- | src/testdir/test_channel.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/testdir/test_channel.py b/src/testdir/test_channel.py index 47a12ea7e0..ca12007a21 100644 --- a/src/testdir/test_channel.py +++ b/src/testdir/test_channel.py @@ -104,11 +104,36 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler): print("sending: {}".format(cmd)) self.request.sendall(cmd.encode('utf-8')) response = "ok" - elif decoded[1] == 'malformed': + elif decoded[1] == 'malformed1': cmd = '["ex",":"]wrong!["ex","smi"]' print("sending: {}".format(cmd)) self.request.sendall(cmd.encode('utf-8')) response = "ok" + elif decoded[1] == 'malformed2': + cmd = '"unterminated string' + print("sending: {}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + # Need to wait for Vim to give up, otherwise the double + # quote in the "ok" response terminates the string. + time.sleep(0.2) + elif decoded[1] == 'malformed3': + cmd = '["ex","missing ]"' + print("sending: {}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" + # Need to wait for Vim to give up, otherwise the ] + # in the "ok" response terminates the list. + time.sleep(0.2) + elif decoded[1] == 'split': + cmd = '["ex","let ' + print("sending: {}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + time.sleep(0.01) + cmd = 'g:split = 123"]' + print("sending: {}".format(cmd)) + self.request.sendall(cmd.encode('utf-8')) + response = "ok" elif decoded[1] == 'an expr': # Send an expr request. cmd = '["expr","setline(\\"$\\", [\\"one\\",\\"two\\",\\"three\\"])"]' |