mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.4835: Vim9: some lines not covered by tests
Problem: Vim9: some lines not covered by tests. Solution: Add a few more tests. Fix disassemble output.
This commit is contained in:
@@ -1691,6 +1691,9 @@ def Test_substitute_expr()
|
|||||||
endfor
|
endfor
|
||||||
assert_equal('yes no abc', getline(1))
|
assert_equal('yes no abc', getline(1))
|
||||||
|
|
||||||
|
setline(1, 'from')
|
||||||
|
v9.CheckDefExecFailure(['s/from/\=g:notexist/'], 'E121: Undefined variable: g:notexist')
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
|
|
||||||
v9.CheckDefFailure(['s/from/\="x")/'], 'E488:')
|
v9.CheckDefFailure(['s/from/\="x")/'], 'E488:')
|
||||||
|
@@ -899,6 +899,25 @@ def Test_disassemble_closure()
|
|||||||
unlet g:Get
|
unlet g:Get
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def s:ClosureArg(arg: string)
|
||||||
|
var Ref = () => arg .. "x"
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def Test_disassemble_closure_arg()
|
||||||
|
var res = execute('disass s:ClosureArg')
|
||||||
|
assert_match('<SNR>\d\+_ClosureArg\_s*' ..
|
||||||
|
'var Ref = () => arg .. "x"\_s*' ..
|
||||||
|
'\d FUNCREF <lambda>\d\+',
|
||||||
|
res)
|
||||||
|
var lres = execute('disass ' .. matchstr(res, '<lambda>\d\+'))
|
||||||
|
assert_match('<lambda>\d\+\_s*' ..
|
||||||
|
'return arg .. "x"\_s*' ..
|
||||||
|
'\d LOADOUTER level 1 arg\[-1]\_s*' ..
|
||||||
|
'\d PUSHS "x"\_s*' ..
|
||||||
|
'\d CONCAT size 2\_s*' ..
|
||||||
|
'\d RETURN',
|
||||||
|
lres)
|
||||||
|
enddef
|
||||||
|
|
||||||
def EchoArg(arg: string): string
|
def EchoArg(arg: string): string
|
||||||
return arg
|
return arg
|
||||||
@@ -2664,6 +2683,22 @@ def Test_disassemble_dict_stack()
|
|||||||
res)
|
res)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def s:RetLegacy(): string
|
||||||
|
legacy return "yes"
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def Test_disassemble_return_legacy()
|
||||||
|
var res = execute('disass s:RetLegacy')
|
||||||
|
assert_match('<SNR>\d*_RetLegacy\_s*' ..
|
||||||
|
'legacy return "yes"\_s*' ..
|
||||||
|
'\d CMDMOD legacy\_s*' ..
|
||||||
|
'\d EVAL legacy "yes"\_s*' ..
|
||||||
|
'\d CHECKTYPE string stack\[-1]\_s*' ..
|
||||||
|
'\d CMDMOD_REV\_s*' ..
|
||||||
|
'\d RETURN',
|
||||||
|
res)
|
||||||
|
enddef
|
||||||
|
|
||||||
def s:EchoMessages()
|
def s:EchoMessages()
|
||||||
echohl ErrorMsg | echom v:exception | echohl NONE
|
echohl ErrorMsg | echom v:exception | echohl NONE
|
||||||
enddef
|
enddef
|
||||||
|
@@ -2376,6 +2376,14 @@ def Test_for_loop_unpack()
|
|||||||
endfor
|
endfor
|
||||||
END
|
END
|
||||||
v9.CheckDefExecFailure(lines, 'E1017:', 1)
|
v9.CheckDefExecFailure(lines, 'E1017:', 1)
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
for [a, b] in g:listlist
|
||||||
|
echo a
|
||||||
|
endfor
|
||||||
|
END
|
||||||
|
g:listlist = [1, 2, 3]
|
||||||
|
v9.CheckDefExecFailure(lines, 'E1140:', 1)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_for_loop_with_try_continue()
|
def Test_for_loop_with_try_continue()
|
||||||
|
@@ -746,6 +746,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 */
|
||||||
|
/**/
|
||||||
|
4835,
|
||||||
/**/
|
/**/
|
||||||
4834,
|
4834,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -5571,7 +5571,7 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc)
|
|||||||
break;
|
break;
|
||||||
case ISN_LOADOUTER:
|
case ISN_LOADOUTER:
|
||||||
{
|
{
|
||||||
if (iptr->isn_arg.number < 0)
|
if (iptr->isn_arg.outer.outer_idx < 0)
|
||||||
smsg("%s%4d LOADOUTER level %d arg[%d]", pfx, current,
|
smsg("%s%4d LOADOUTER level %d arg[%d]", pfx, current,
|
||||||
iptr->isn_arg.outer.outer_depth,
|
iptr->isn_arg.outer.outer_depth,
|
||||||
iptr->isn_arg.outer.outer_idx
|
iptr->isn_arg.outer.outer_idx
|
||||||
|
Reference in New Issue
Block a user