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.
Files: src/channel.c, src/testdir/test_channel.vim,
src/testdir/test_channel.py
*** ../vim-7.4.1661/src/channel.c 2016-03-21 22:30:52.859454907 +0100
--- src/channel.c 2016-03-26 22:45:35.410530251 +0100
***************
*** 1661,1668 ****
--- 1661,1677 ----
if (STRCMP(cmd, "ex") == 0)
{
+ int save_called_emsg = called_emsg;
+
+ called_emsg = FALSE;
ch_logs(channel, "Executing ex command '%s'", (char *)arg);
+ ++emsg_silent;
do_cmdline_cmd(arg);
+ --emsg_silent;
+ if (called_emsg)
+ ch_logs(channel, "Ex command error: '%s'",
+ (char *)get_vim_var_str(VV_ERRMSG));
+ called_emsg = save_called_emsg;
}
else if (STRCMP(cmd, "normal") == 0)
{
*** ../vim-7.4.1661/src/testdir/test_channel.vim 2016-03-26
22:19:23.866720901 +0100
--- src/testdir/test_channel.vim 2016-03-26 22:56:12.527949442 +0100
***************
*** 151,156 ****
--- 151,161 ----
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('$'))
*** ../vim-7.4.1661/src/testdir/test_channel.py 2016-03-26 22:19:23.866720901
+0100
--- src/testdir/test_channel.py 2016-03-26 22:36:49.271970150 +0100
***************
*** 73,78 ****
--- 73,83 ----
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"]'
*** ../vim-7.4.1661/src/version.c 2016-03-26 22:19:23.866720901 +0100
--- src/version.c 2016-03-26 22:53:37.145554051 +0100
***************
*** 750,751 ****
--- 750,753 ----
{ /* Add new patch number below this line */
+ /**/
+ 1662,
/**/
--
hundred-and-one symptoms of being an internet addict:
135. You cut classes or miss work so you can stay home and browse the web.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.