0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.0313: Vim9: insufficient script tests

Problem:    Vim9: insufficient script tests.
Solution:   Add tests.  Make import of alphanumeric name work.
This commit is contained in:
Bram Moolenaar
2020-02-23 22:35:05 +01:00
parent f2d5c240a5
commit fa29c8abd6
3 changed files with 55 additions and 7 deletions

View File

@@ -172,7 +172,7 @@ find_exported(
scriptitem_T *script = SCRIPT_ITEM(sid);
// isolate one name
while (eval_isnamec1(*arg))
while (eval_isnamec(*arg))
++arg;
*name_len = (int)(arg - name);
@@ -262,9 +262,9 @@ handle_import(char_u *arg_start, garray_T *gap, int import_sid)
{
if (*arg == '*')
arg = skipwhite(arg + 1);
else
else if (eval_isnamec1(*arg))
{
while (eval_isnamec1(*arg))
while (eval_isnamec(*arg))
++arg;
arg = skipwhite(arg);
}
@@ -273,8 +273,9 @@ handle_import(char_u *arg_start, garray_T *gap, int import_sid)
// skip over "as Name "
arg = skipwhite(arg + 2);
as_ptr = arg;
while (eval_isnamec1(*arg))
++arg;
if (eval_isnamec1(*arg))
while (eval_isnamec(*arg))
++arg;
as_len = (int)(arg - as_ptr);
arg = skipwhite(arg);
}
@@ -286,7 +287,7 @@ handle_import(char_u *arg_start, garray_T *gap, int import_sid)
}
if (STRNCMP("from", arg, 4) != 0 || !VIM_ISWHITE(arg[4]))
{
emsg(_("E1045: Missing \"from\""));
emsg(_("E1070: Missing \"from\""));
return NULL;
}
from_ptr = arg;
@@ -299,7 +300,7 @@ handle_import(char_u *arg_start, garray_T *gap, int import_sid)
ret = get_string_tv(&arg, &tv, TRUE);
if (ret == FAIL || tv.vval.v_string == NULL || *tv.vval.v_string == NUL)
{
emsg(_("E1045: Invalid string after \"from\""));
emsg(_("E1071: Invalid string after \"from\""));
return NULL;
}
cmd_end = arg;
@@ -423,6 +424,7 @@ handle_import(char_u *arg_start, garray_T *gap, int import_sid)
}
if (arg != from_ptr)
{
// cannot happen, just in case the above has a flaw
emsg(_("E1047: syntax error in import"));
return NULL;
}