patch 7.4.1662
Problem: No test for an invalid Ex command on a channel.
Solution: Test handling an invalid command gracefully. Avoid getting an
error message, do write it to the channel log.
diff --git a/src/testdir/test_channel.py b/src/testdir/test_channel.py
index 227780a..b5a912c 100644
--- a/src/testdir/test_channel.py
+++ b/src/testdir/test_channel.py
@@ -73,6 +73,11 @@
print("sending: {0}".format(cmd))
self.request.sendall(cmd.encode('utf-8'))
response = "ok"
+ elif decoded[1] == 'bad command':
+ cmd = '["ex","foo bar"]'
+ print("sending: {0}".format(cmd))
+ self.request.sendall(cmd.encode('utf-8'))
+ response = "ok"
elif decoded[1] == 'do normal':
# Send a normal command.
cmd = '["normal","G$s more\u001b"]'
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index b356c88..7051223 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -151,6 +151,11 @@
call assert_equal('added1', getline(line('$') - 1))
call assert_equal('added2', getline('$'))
+ " Request command "foo bar", which fails silently.
+ call assert_equal('ok', ch_evalexpr(handle, 'bad command'))
+ call s:waitFor('v:errmsg =~ "E492"')
+ call assert_true(v:errmsg =~ 'E492:.*foo bar')
+
call assert_equal('ok', ch_evalexpr(handle, 'do normal', {'timeout': 100}))
call s:waitFor('"added more" == getline("$")')
call assert_equal('added more', getline('$'))