forked from aniani/vim
patch 8.2.3856: Vim9: not enough tests
Problem: Vim9: not enough tests. Solution: Run more expression tests also with Vim9. Fix an uncovered problem.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -185,32 +185,33 @@ def CheckTransLegacySuccess(lines: list<string>)
|
||||
->substitute('\<LSTART\>', '{', 'g')
|
||||
->substitute('\<LMIDDLE\>', '->', 'g')
|
||||
->substitute('\<LEND\>', '}', 'g')
|
||||
->substitute('\<TRUE\>', '1', 'g')
|
||||
->substitute('\<FALSE\>', '0', 'g')
|
||||
->substitute('#"', ' "', 'g'))
|
||||
CheckLegacySuccess(legacylines)
|
||||
enddef
|
||||
|
||||
def Vim9Trans(lines: list<string>): list<string>
|
||||
return lines->mapnew((_, v) =>
|
||||
v->substitute('\<VAR\>', 'var', 'g')
|
||||
->substitute('\<LET ', '', 'g')
|
||||
->substitute('\<LSTART\>', '(', 'g')
|
||||
->substitute('\<LMIDDLE\>', ') =>', 'g')
|
||||
->substitute(' *\<LEND\> *', '', 'g')
|
||||
->substitute('\<TRUE\>', 'true', 'g')
|
||||
->substitute('\<FALSE\>', 'false', 'g'))
|
||||
enddef
|
||||
|
||||
" Execute "lines" in a :def function, translated as in
|
||||
" CheckLegacyAndVim9Success()
|
||||
def CheckTransDefSuccess(lines: list<string>)
|
||||
var vim9lines = lines->mapnew((_, v) =>
|
||||
v->substitute('\<VAR\>', 'var', 'g')
|
||||
->substitute('\<LET ', '', 'g')
|
||||
->substitute('\<LSTART\>', '(', 'g')
|
||||
->substitute('\<LMIDDLE\>', ') =>', 'g')
|
||||
->substitute(' *\<LEND\> *', '', 'g'))
|
||||
CheckDefSuccess(vim9lines)
|
||||
CheckDefSuccess(Vim9Trans(lines))
|
||||
enddef
|
||||
|
||||
" Execute "lines" in a Vim9 script, translated as in
|
||||
" CheckLegacyAndVim9Success()
|
||||
def CheckTransVim9Success(lines: list<string>)
|
||||
var vim9lines = lines->mapnew((_, v) =>
|
||||
v->substitute('\<VAR\>', 'var', 'g')
|
||||
->substitute('\<LET ', '', 'g')
|
||||
->substitute('\<LSTART\>', '(', 'g')
|
||||
->substitute('\<LMIDDLE\>', ') =>', 'g')
|
||||
->substitute(' *\<LEND\> *', '', 'g'))
|
||||
CheckScriptSuccess(['vim9script'] + vim9lines)
|
||||
CheckScriptSuccess(['vim9script'] + Vim9Trans(lines))
|
||||
enddef
|
||||
|
||||
" Execute "lines" in a legacy function, :def function and Vim9 script.
|
||||
@@ -218,6 +219,8 @@ enddef
|
||||
" Use 'LET' for an assignment
|
||||
" Use ' #"' for a comment
|
||||
" Use LSTART arg LMIDDLE expr LEND for lambda
|
||||
" Use 'TRUE' for 1 in legacy, true in Vim9
|
||||
" Use 'FALSE' for 0 in legacy, false in Vim9
|
||||
def CheckLegacyAndVim9Success(lines: list<string>)
|
||||
CheckTransLegacySuccess(lines)
|
||||
CheckTransDefSuccess(lines)
|
||||
|
@@ -749,6 +749,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
3856,
|
||||
/**/
|
||||
3855,
|
||||
/**/
|
||||
|
@@ -4308,7 +4308,8 @@ compile_leader(cctx_T *cctx, int numeric_only, char_u *start, char_u **end)
|
||||
type_T *type;
|
||||
|
||||
type = ((type_T **)stack->ga_data)[stack->ga_len - 1];
|
||||
if (need_type(type, &t_number, -1, 0, cctx, FALSE, FALSE) == FAIL)
|
||||
if (type != &t_float && need_type(type, &t_number,
|
||||
-1, 0, cctx, FALSE, FALSE) == FAIL)
|
||||
return FAIL;
|
||||
|
||||
while (p > start && (p[-1] == '-' || p[-1] == '+'))
|
||||
|
Reference in New Issue
Block a user