summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_channel.py16
-rw-r--r--src/testdir/test_channel.vim17
2 files changed, 28 insertions, 5 deletions
diff --git a/src/testdir/test_channel.py b/src/testdir/test_channel.py
index 61e76ec4f..227780a5e 100644
--- a/src/testdir/test_channel.py
+++ b/src/testdir/test_channel.py
@@ -85,16 +85,28 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
print("sending: {0}".format(cmd))
self.request.sendall(cmd.encode('utf-8'))
response = "ok"
+ elif decoded[1] == 'eval-special':
+ # Send an eval request. We ignore the response.
+ cmd = '["expr","\\"foo\x7f\x10\x01bar\\"", -2]'
+ print("sending: {0}".format(cmd))
+ self.request.sendall(cmd.encode('utf-8'))
+ response = "ok"
+ elif decoded[1] == 'eval-getline':
+ # Send an eval request. We ignore the response.
+ cmd = '["expr","getline(3)", -3]'
+ print("sending: {0}".format(cmd))
+ self.request.sendall(cmd.encode('utf-8'))
+ response = "ok"
elif decoded[1] == 'eval-fails':
# Send an eval request that will fail.
- cmd = '["expr","xxx", -2]'
+ cmd = '["expr","xxx", -4]'
print("sending: {0}".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 = '["expr","function(\\"tr\\")", -3]'
+ cmd = '["expr","function(\\"tr\\")", -5]'
print("sending: {0}".format(cmd))
self.request.sendall(cmd.encode('utf-8'))
response = "ok"
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index dd40187f7..b356c88fe 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -192,20 +192,31 @@ func s:communicate(port)
sleep 10m
call assert_equal([-1, 'foo123'], ch_evalexpr(handle, 'eval-result'))
+ " Send an eval request with special characters.
+ call assert_equal('ok', ch_evalexpr(handle, 'eval-special'))
+ sleep 10m
+ call assert_equal([-2, "foo\x7f\x10\x01bar"], ch_evalexpr(handle, 'eval-result'))
+
+ " Send an eval request to get a line with special characters.
+ call setline(3, "a\nb\<CR>c\x01d\x7fe")
+ call assert_equal('ok', ch_evalexpr(handle, 'eval-getline'))
+ sleep 10m
+ call assert_equal([-3, "a\nb\<CR>c\x01d\x7fe"], ch_evalexpr(handle, 'eval-result'))
+
" Send an eval request that fails.
call assert_equal('ok', ch_evalexpr(handle, 'eval-fails'))
sleep 10m
- call assert_equal([-2, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
+ call assert_equal([-4, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
" Send an eval request that works but can't be encoded.
call assert_equal('ok', ch_evalexpr(handle, 'eval-error'))
sleep 10m
- call assert_equal([-3, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
+ call assert_equal([-5, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
" Send a bad eval request. There will be no response.
call assert_equal('ok', ch_evalexpr(handle, 'eval-bad'))
sleep 10m
- call assert_equal([-3, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
+ call assert_equal([-5, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
" Send an expr request
call assert_equal('ok', ch_evalexpr(handle, 'an expr'))