comparison src/testdir/test_channel.py @ 7965:646d5148fee2 v7.4.1278

commit https://github.com/vim/vim/commit/55fab439a6f3bba6dbe780ac034b84d5822a1a96 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 7 16:53:13 2016 +0100 patch 7.4.1278 Problem: When jsonencode() fails it still returns something. Solution: Return an empty string on failure.
author Christian Brabandt <cb@256bit.org>
date Sun, 07 Feb 2016 17:00:05 +0100
parents dcc0bd6b1574
children 0756eab66b71
comparison
equal deleted inserted replaced
7964:78b678f510f4 7965:646d5148fee2
91 # Send an eval request that will fail. 91 # Send an eval request that will fail.
92 cmd = '["eval","xxx", -2]' 92 cmd = '["eval","xxx", -2]'
93 print("sending: {}".format(cmd)) 93 print("sending: {}".format(cmd))
94 self.request.sendall(cmd.encode('utf-8')) 94 self.request.sendall(cmd.encode('utf-8'))
95 response = "ok" 95 response = "ok"
96 elif decoded[1] == 'eval-error':
97 # Send an eval request that works but the result can't
98 # be encoded.
99 cmd = '["eval","function(\\"tr\\")", -3]'
100 print("sending: {}".format(cmd))
101 self.request.sendall(cmd.encode('utf-8'))
102 response = "ok"
96 elif decoded[1] == 'eval-bad': 103 elif decoded[1] == 'eval-bad':
97 # Send an eval request missing the third argument. 104 # Send an eval request missing the third argument.
98 cmd = '["eval","xxx"]' 105 cmd = '["eval","xxx"]'
99 print("sending: {}".format(cmd)) 106 print("sending: {}".format(cmd))
100 self.request.sendall(cmd.encode('utf-8')) 107 self.request.sendall(cmd.encode('utf-8'))