forked from aniani/vim
patch 8.2.2710: Vim9: not all tests cover script and :def function
Problem: Vim9: not all tests cover script and :def function. Solution: Run tests in both if possible. Fix differences.
This commit is contained in:
parent
26af8e54ff
commit
90193e6140
19
src/eval.c
19
src/eval.c
@ -2330,7 +2330,7 @@ eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
|
||||
{
|
||||
if (evaluate && vim9script && !VIM_ISWHITE(p[-1]))
|
||||
{
|
||||
error_white_both(p, 1);
|
||||
error_white_both(p, op_falsy ? 2 : 1);
|
||||
clear_tv(rettv);
|
||||
return FAIL;
|
||||
}
|
||||
@ -2361,7 +2361,7 @@ eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
|
||||
++*arg;
|
||||
if (evaluate && vim9script && !IS_WHITE_OR_NUL((*arg)[1]))
|
||||
{
|
||||
error_white_both(p, 1);
|
||||
error_white_both(p, op_falsy ? 2 : 1);
|
||||
clear_tv(rettv);
|
||||
return FAIL;
|
||||
}
|
||||
@ -2774,7 +2774,7 @@ eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
|
||||
*/
|
||||
if (evaluate && vim9script && !IS_WHITE_OR_NUL(p[len]))
|
||||
{
|
||||
error_white_both(p, 1);
|
||||
error_white_both(p, len);
|
||||
clear_tv(rettv);
|
||||
return FAIL;
|
||||
}
|
||||
@ -3438,9 +3438,16 @@ eval7(
|
||||
case '@': ++*arg;
|
||||
if (evaluate)
|
||||
{
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = get_reg_contents(**arg,
|
||||
GREG_EXPR_SRC);
|
||||
if (in_vim9script() && IS_WHITE_OR_NUL(**arg))
|
||||
semsg(_(e_syntax_error_at_str), *arg);
|
||||
else if (in_vim9script() && !valid_yank_reg(**arg, FALSE))
|
||||
emsg_invreg(**arg);
|
||||
else
|
||||
{
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = get_reg_contents(**arg,
|
||||
GREG_EXPR_SRC);
|
||||
}
|
||||
}
|
||||
if (**arg != NUL)
|
||||
++*arg;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -107,9 +107,29 @@ def CheckDefAndScriptFailure(lines: list<string>, error: string, lnum = -3)
|
||||
CheckScriptFailure(['vim9script'] + lines, error, lnum + 1)
|
||||
enddef
|
||||
|
||||
" As CheckDefAndScriptFailure() but with two different exepcted errors.
|
||||
def CheckDefAndScriptFailure2(
|
||||
lines: list<string>,
|
||||
errorDef: string,
|
||||
errorScript: string,
|
||||
lnum = -3)
|
||||
CheckDefFailure(lines, errorDef, lnum)
|
||||
CheckScriptFailure(['vim9script'] + lines, errorScript, lnum + 1)
|
||||
enddef
|
||||
|
||||
" Check that a command fails with the same error when executed in a :def
|
||||
" function and when used in Vim9 script.
|
||||
def CheckDefExecAndScriptFailure(lines: list<string>, error: string, lnum = -3)
|
||||
CheckDefExecFailure(lines, error, lnum)
|
||||
CheckScriptFailure(['vim9script'] + lines, error, lnum + 1)
|
||||
enddef
|
||||
|
||||
" As CheckDefExecAndScriptFailure() but with two different expected errors.
|
||||
def CheckDefExecAndScriptFailure2(
|
||||
lines: list<string>,
|
||||
errorDef: string,
|
||||
errorScript: string,
|
||||
lnum = -3)
|
||||
CheckDefExecFailure(lines, errorDef, lnum)
|
||||
CheckScriptFailure(['vim9script'] + lines, errorScript, lnum + 1)
|
||||
enddef
|
||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2710,
|
||||
/**/
|
||||
2709,
|
||||
/**/
|
||||
|
@ -4106,7 +4106,7 @@ compile_subscript(
|
||||
ppconst->pp_is_const = FALSE;
|
||||
|
||||
*arg = p + 1;
|
||||
if (may_get_next_line(*arg, arg, cctx) == FAIL)
|
||||
if (IS_WHITE_OR_NUL(**arg))
|
||||
{
|
||||
emsg(_(e_missing_name_after_dot));
|
||||
return FAIL;
|
||||
@ -4785,7 +4785,7 @@ compile_and_or(
|
||||
if (!IS_WHITE_OR_NUL(**arg) || !IS_WHITE_OR_NUL(p[2]))
|
||||
{
|
||||
semsg(_(e_white_space_required_before_and_after_str_at_str),
|
||||
op, *arg);
|
||||
op, p);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
@ -3962,9 +3962,16 @@ on_fatal_error:
|
||||
|
||||
done:
|
||||
// function finished, get result from the stack.
|
||||
tv = STACK_TV_BOT(-1);
|
||||
*rettv = *tv;
|
||||
tv->v_type = VAR_UNKNOWN;
|
||||
if (ufunc->uf_ret_type == &t_void)
|
||||
{
|
||||
rettv->v_type = VAR_VOID;
|
||||
}
|
||||
else
|
||||
{
|
||||
tv = STACK_TV_BOT(-1);
|
||||
*rettv = *tv;
|
||||
tv->v_type = VAR_UNKNOWN;
|
||||
}
|
||||
ret = OK;
|
||||
|
||||
failed:
|
||||
|
Loading…
x
Reference in New Issue
Block a user