mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
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:
13
src/eval.c
13
src/eval.c
@@ -2330,7 +2330,7 @@ eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
|
|||||||
{
|
{
|
||||||
if (evaluate && vim9script && !VIM_ISWHITE(p[-1]))
|
if (evaluate && vim9script && !VIM_ISWHITE(p[-1]))
|
||||||
{
|
{
|
||||||
error_white_both(p, 1);
|
error_white_both(p, op_falsy ? 2 : 1);
|
||||||
clear_tv(rettv);
|
clear_tv(rettv);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@@ -2361,7 +2361,7 @@ eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
|
|||||||
++*arg;
|
++*arg;
|
||||||
if (evaluate && vim9script && !IS_WHITE_OR_NUL((*arg)[1]))
|
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);
|
clear_tv(rettv);
|
||||||
return FAIL;
|
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]))
|
if (evaluate && vim9script && !IS_WHITE_OR_NUL(p[len]))
|
||||||
{
|
{
|
||||||
error_white_both(p, 1);
|
error_white_both(p, len);
|
||||||
clear_tv(rettv);
|
clear_tv(rettv);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@@ -3437,11 +3437,18 @@ eval7(
|
|||||||
*/
|
*/
|
||||||
case '@': ++*arg;
|
case '@': ++*arg;
|
||||||
if (evaluate)
|
if (evaluate)
|
||||||
|
{
|
||||||
|
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->v_type = VAR_STRING;
|
||||||
rettv->vval.v_string = get_reg_contents(**arg,
|
rettv->vval.v_string = get_reg_contents(**arg,
|
||||||
GREG_EXPR_SRC);
|
GREG_EXPR_SRC);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (**arg != NUL)
|
if (**arg != NUL)
|
||||||
++*arg;
|
++*arg;
|
||||||
break;
|
break;
|
||||||
|
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)
|
CheckScriptFailure(['vim9script'] + lines, error, lnum + 1)
|
||||||
enddef
|
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
|
" Check that a command fails with the same error when executed in a :def
|
||||||
" function and when used in Vim9 script.
|
" function and when used in Vim9 script.
|
||||||
def CheckDefExecAndScriptFailure(lines: list<string>, error: string, lnum = -3)
|
def CheckDefExecAndScriptFailure(lines: list<string>, error: string, lnum = -3)
|
||||||
CheckDefExecFailure(lines, error, lnum)
|
CheckDefExecFailure(lines, error, lnum)
|
||||||
CheckScriptFailure(['vim9script'] + lines, error, lnum + 1)
|
CheckScriptFailure(['vim9script'] + lines, error, lnum + 1)
|
||||||
enddef
|
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[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2710,
|
||||||
/**/
|
/**/
|
||||||
2709,
|
2709,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -4106,7 +4106,7 @@ compile_subscript(
|
|||||||
ppconst->pp_is_const = FALSE;
|
ppconst->pp_is_const = FALSE;
|
||||||
|
|
||||||
*arg = p + 1;
|
*arg = p + 1;
|
||||||
if (may_get_next_line(*arg, arg, cctx) == FAIL)
|
if (IS_WHITE_OR_NUL(**arg))
|
||||||
{
|
{
|
||||||
emsg(_(e_missing_name_after_dot));
|
emsg(_(e_missing_name_after_dot));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@@ -4785,7 +4785,7 @@ compile_and_or(
|
|||||||
if (!IS_WHITE_OR_NUL(**arg) || !IS_WHITE_OR_NUL(p[2]))
|
if (!IS_WHITE_OR_NUL(**arg) || !IS_WHITE_OR_NUL(p[2]))
|
||||||
{
|
{
|
||||||
semsg(_(e_white_space_required_before_and_after_str_at_str),
|
semsg(_(e_white_space_required_before_and_after_str_at_str),
|
||||||
op, *arg);
|
op, p);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3962,9 +3962,16 @@ on_fatal_error:
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
// function finished, get result from the stack.
|
// function finished, get result from the stack.
|
||||||
|
if (ufunc->uf_ret_type == &t_void)
|
||||||
|
{
|
||||||
|
rettv->v_type = VAR_VOID;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
tv = STACK_TV_BOT(-1);
|
tv = STACK_TV_BOT(-1);
|
||||||
*rettv = *tv;
|
*rettv = *tv;
|
||||||
tv->v_type = VAR_UNKNOWN;
|
tv->v_type = VAR_UNKNOWN;
|
||||||
|
}
|
||||||
ret = OK;
|
ret = OK;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
|
Reference in New Issue
Block a user