mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.0103: using null object with execute() has strange effects
Problem: Using null object with execute() has strange effects. Solution: Give an error message ofr Job and Channel.
This commit is contained in:
@@ -5667,7 +5667,7 @@ tv_get_string_buf_chk(typval_T *varp, char_u *buf)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case VAR_UNKNOWN:
|
case VAR_UNKNOWN:
|
||||||
emsg(_("E908: using an invalid value as a String"));
|
emsg(_(e_inval_string));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@@ -2015,6 +2015,12 @@ execute_common(typval_T *argvars, typval_T *rettv, int arg_off)
|
|||||||
return;
|
return;
|
||||||
++list->lv_refcount;
|
++list->lv_refcount;
|
||||||
}
|
}
|
||||||
|
else if (argvars[arg_off].v_type == VAR_JOB
|
||||||
|
|| argvars[arg_off].v_type == VAR_CHANNEL)
|
||||||
|
{
|
||||||
|
emsg(_(e_inval_string));
|
||||||
|
return;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmd = tv_get_string_chk(&argvars[arg_off]);
|
cmd = tv_get_string_chk(&argvars[arg_off]);
|
||||||
|
@@ -1599,6 +1599,7 @@ EXTERN char e_listreq[] INIT(= N_("E714: List required"));
|
|||||||
EXTERN char e_listblobreq[] INIT(= N_("E897: List or Blob required"));
|
EXTERN char e_listblobreq[] INIT(= N_("E897: List or Blob required"));
|
||||||
EXTERN char e_listdictarg[] INIT(= N_("E712: Argument of %s must be a List or Dictionary"));
|
EXTERN char e_listdictarg[] INIT(= N_("E712: Argument of %s must be a List or Dictionary"));
|
||||||
EXTERN char e_listdictblobarg[] INIT(= N_("E896: Argument of %s must be a List, Dictionary or Blob"));
|
EXTERN char e_listdictblobarg[] INIT(= N_("E896: Argument of %s must be a List, Dictionary or Blob"));
|
||||||
|
EXTERN char e_inval_string[] INIT(= N_("E908: using an invalid value as a String"));
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_QUICKFIX
|
#ifdef FEAT_QUICKFIX
|
||||||
EXTERN char e_readerrf[] INIT(= N_("E47: Error while reading errorfile"));
|
EXTERN char e_readerrf[] INIT(= N_("E47: Error while reading errorfile"));
|
||||||
|
@@ -38,8 +38,6 @@ func Test_execute_string()
|
|||||||
call assert_equal("\nsomething", execute('echo "something"', 'silent!'))
|
call assert_equal("\nsomething", execute('echo "something"', 'silent!'))
|
||||||
call assert_equal("", execute('burp', 'silent!'))
|
call assert_equal("", execute('burp', 'silent!'))
|
||||||
call assert_fails('call execute("echo \"x\"", 3.4)', 'E806:')
|
call assert_fails('call execute("echo \"x\"", 3.4)', 'E806:')
|
||||||
|
|
||||||
call assert_equal("", execute(test_null_string()))
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_execute_list()
|
func Test_execute_list()
|
||||||
@@ -50,7 +48,6 @@ func Test_execute_list()
|
|||||||
call assert_equal("\n0\n1\n2\n3", execute(l))
|
call assert_equal("\n0\n1\n2\n3", execute(l))
|
||||||
|
|
||||||
call assert_equal("", execute([]))
|
call assert_equal("", execute([]))
|
||||||
call assert_equal("", execute(test_null_list()))
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_execute_does_not_change_col()
|
func Test_execute_does_not_change_col()
|
||||||
@@ -132,3 +129,15 @@ func Test_win_execute_other_tab()
|
|||||||
tabclose
|
tabclose
|
||||||
unlet xyz
|
unlet xyz
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_execute_null()
|
||||||
|
call assert_equal("", execute(test_null_string()))
|
||||||
|
call assert_equal("", execute(test_null_list()))
|
||||||
|
call assert_fails('call execute(test_null_dict())', 'E731:')
|
||||||
|
call assert_fails('call execute(test_null_blob())', 'E976:')
|
||||||
|
call assert_fails('call execute(test_null_partial())','E729:')
|
||||||
|
if has('job')
|
||||||
|
call assert_fails('call execute(test_null_job())', 'E908:')
|
||||||
|
call assert_fails('call execute(test_null_channel())', 'E908:')
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
@@ -742,6 +742,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
103,
|
||||||
/**/
|
/**/
|
||||||
102,
|
102,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user