mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.4836: Vim9: some lines not covered by tests
Problem: Vim9: some lines not covered by tests. Solution: Remove dead code. Add disassemble tests.
This commit is contained in:
@@ -265,6 +265,7 @@ enddef
|
|||||||
|
|
||||||
def s:PutRange()
|
def s:PutRange()
|
||||||
:$-2put a
|
:$-2put a
|
||||||
|
:$-3put! b
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_disassemble_put_range()
|
def Test_disassemble_put_range()
|
||||||
@@ -273,6 +274,10 @@ def Test_disassemble_put_range()
|
|||||||
' :$-2put a\_s*' ..
|
' :$-2put a\_s*' ..
|
||||||
'\d RANGE $-2\_s*' ..
|
'\d RANGE $-2\_s*' ..
|
||||||
'\d PUT a range\_s*' ..
|
'\d PUT a range\_s*' ..
|
||||||
|
|
||||||
|
' :$-3put! b\_s*' ..
|
||||||
|
'\d RANGE $-3\_s*' ..
|
||||||
|
'\d PUT b above range\_s*' ..
|
||||||
'\d RETURN void',
|
'\d RETURN void',
|
||||||
res)
|
res)
|
||||||
enddef
|
enddef
|
||||||
@@ -684,6 +689,10 @@ def s:ScriptFuncUnlet()
|
|||||||
unlet g:somevar
|
unlet g:somevar
|
||||||
unlet! g:somevar
|
unlet! g:somevar
|
||||||
unlet $SOMEVAR
|
unlet $SOMEVAR
|
||||||
|
|
||||||
|
var l = [1, 2, 3]
|
||||||
|
unlet l[2]
|
||||||
|
unlet l[0 : 1]
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_disassemble_unlet()
|
def Test_disassemble_unlet()
|
||||||
@@ -697,13 +706,33 @@ def Test_disassemble_unlet()
|
|||||||
'unlet! g:somevar\_s*' ..
|
'unlet! g:somevar\_s*' ..
|
||||||
'\d UNLET! g:somevar\_s*' ..
|
'\d UNLET! g:somevar\_s*' ..
|
||||||
'unlet $SOMEVAR\_s*' ..
|
'unlet $SOMEVAR\_s*' ..
|
||||||
'\d UNLETENV $SOMEVAR\_s*',
|
'\d UNLETENV $SOMEVAR\_s*' ..
|
||||||
|
|
||||||
|
'var l = \[1, 2, 3]\_s*' ..
|
||||||
|
'\d\+ PUSHNR 1\_s*' ..
|
||||||
|
'\d\+ PUSHNR 2\_s*' ..
|
||||||
|
'\d\+ PUSHNR 3\_s*' ..
|
||||||
|
'\d\+ NEWLIST size 3\_s*' ..
|
||||||
|
'\d\+ SETTYPE list<number>\_s*' ..
|
||||||
|
'\d\+ STORE $0\_s*' ..
|
||||||
|
|
||||||
|
'unlet l\[2]\_s*' ..
|
||||||
|
'\d\+ PUSHNR 2\_s*' ..
|
||||||
|
'\d\+ LOAD $0\_s*' ..
|
||||||
|
'\d\+ UNLETINDEX\_s*' ..
|
||||||
|
|
||||||
|
'unlet l\[0 : 1]\_s*' ..
|
||||||
|
'\d\+ PUSHNR 0\_s*' ..
|
||||||
|
'\d\+ PUSHNR 1\_s*' ..
|
||||||
|
'\d\+ LOAD $0\_s*' ..
|
||||||
|
'\d\+ UNLETRANGE\_s*',
|
||||||
res)
|
res)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def s:LockLocal()
|
def s:LockLocal()
|
||||||
var d = {a: 1}
|
var d = {a: 1}
|
||||||
lockvar d.a
|
lockvar d.a
|
||||||
|
const nr = 22
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_disassemble_lock_local()
|
def Test_disassemble_lock_local()
|
||||||
@@ -717,7 +746,12 @@ def Test_disassemble_lock_local()
|
|||||||
'\d STORE $0\_s*' ..
|
'\d STORE $0\_s*' ..
|
||||||
'lockvar d.a\_s*' ..
|
'lockvar d.a\_s*' ..
|
||||||
'\d LOAD $0\_s*' ..
|
'\d LOAD $0\_s*' ..
|
||||||
'\d LOCKUNLOCK lockvar 2 d.a\_s*',
|
'\d LOCKUNLOCK lockvar 2 d.a\_s*' ..
|
||||||
|
|
||||||
|
'const nr = 22\_s*' ..
|
||||||
|
'\d\+ PUSHNR 22\_s*' ..
|
||||||
|
'\d\+ LOCKCONST\_s*' ..
|
||||||
|
'\d\+ STORE $1',
|
||||||
res)
|
res)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
@@ -2186,6 +2220,33 @@ def Test_disassemble_range_only()
|
|||||||
res)
|
res)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def s:StoreRange()
|
||||||
|
var l = [1, 2]
|
||||||
|
l[0 : 1] = [7, 8]
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def Test_disassemble_store_range()
|
||||||
|
var res = execute('disass s:StoreRange')
|
||||||
|
assert_match('\<SNR>\d*_StoreRange\_s*' ..
|
||||||
|
'var l = \[1, 2]\_s*' ..
|
||||||
|
'\d PUSHNR 1\_s*' ..
|
||||||
|
'\d PUSHNR 2\_s*' ..
|
||||||
|
'\d NEWLIST size 2\_s*' ..
|
||||||
|
'\d SETTYPE list<number>\_s*' ..
|
||||||
|
'\d STORE $0\_s*' ..
|
||||||
|
|
||||||
|
'l\[0 : 1] = \[7, 8]\_s*' ..
|
||||||
|
'\d\+ PUSHNR 7\_s*' ..
|
||||||
|
'\d\+ PUSHNR 8\_s*' ..
|
||||||
|
'\d\+ NEWLIST size 2\_s*' ..
|
||||||
|
'\d\+ PUSHNR 0\_s*' ..
|
||||||
|
'\d\+ PUSHNR 1\_s*' ..
|
||||||
|
'\d\+ LOAD $0\_s*' ..
|
||||||
|
'\d\+ STORERANGE\_s*' ..
|
||||||
|
'\d\+ RETURN void',
|
||||||
|
res)
|
||||||
|
enddef
|
||||||
|
|
||||||
def s:Echomsg()
|
def s:Echomsg()
|
||||||
echomsg 'some' 'message'
|
echomsg 'some' 'message'
|
||||||
echoconsole 'nothing'
|
echoconsole 'nothing'
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
4836,
|
||||||
/**/
|
/**/
|
||||||
4835,
|
4835,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -239,7 +239,6 @@ typedef enum {
|
|||||||
JUMP_NEVER,
|
JUMP_NEVER,
|
||||||
JUMP_IF_FALSE, // pop and jump if false
|
JUMP_IF_FALSE, // pop and jump if false
|
||||||
JUMP_AND_KEEP_IF_TRUE, // jump if top of stack is truthy, drop if not
|
JUMP_AND_KEEP_IF_TRUE, // jump if top of stack is truthy, drop if not
|
||||||
JUMP_AND_KEEP_IF_FALSE, // jump if top of stack is falsy, drop if not
|
|
||||||
JUMP_IF_COND_TRUE, // jump if top of stack is true, drop if not
|
JUMP_IF_COND_TRUE, // jump if top of stack is true, drop if not
|
||||||
JUMP_IF_COND_FALSE, // jump if top of stack is false, drop if not
|
JUMP_IF_COND_FALSE, // jump if top of stack is false, drop if not
|
||||||
} jumpwhen_T;
|
} jumpwhen_T;
|
||||||
|
@@ -3788,9 +3788,7 @@ exec_instructions(ectx_T *ectx)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
jump = tv2bool(tv);
|
jump = tv2bool(tv);
|
||||||
if (when == JUMP_IF_FALSE
|
if (when == JUMP_IF_FALSE || when == JUMP_IF_COND_FALSE)
|
||||||
|| when == JUMP_AND_KEEP_IF_FALSE
|
|
||||||
|| when == JUMP_IF_COND_FALSE)
|
|
||||||
jump = !jump;
|
jump = !jump;
|
||||||
if (when == JUMP_IF_FALSE || !jump)
|
if (when == JUMP_IF_FALSE || !jump)
|
||||||
{
|
{
|
||||||
@@ -5662,16 +5660,9 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc)
|
|||||||
iptr->isn_arg.number);
|
iptr->isn_arg.number);
|
||||||
break;
|
break;
|
||||||
case ISN_STOREOUTER:
|
case ISN_STOREOUTER:
|
||||||
{
|
smsg("%s%4d STOREOUTER level %d $%d", pfx, current,
|
||||||
if (iptr->isn_arg.number < 0)
|
iptr->isn_arg.outer.outer_depth,
|
||||||
smsg("%s%4d STOREOUTEr level %d arg[%d]", pfx, current,
|
iptr->isn_arg.outer.outer_idx);
|
||||||
iptr->isn_arg.outer.outer_depth,
|
|
||||||
iptr->isn_arg.outer.outer_idx + STACK_FRAME_SIZE);
|
|
||||||
else
|
|
||||||
smsg("%s%4d STOREOUTER level %d $%d", pfx, current,
|
|
||||||
iptr->isn_arg.outer.outer_depth,
|
|
||||||
iptr->isn_arg.outer.outer_idx);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case ISN_STOREV:
|
case ISN_STOREV:
|
||||||
smsg("%s%4d STOREV v:%s", pfx, current,
|
smsg("%s%4d STOREV v:%s", pfx, current,
|
||||||
@@ -5935,9 +5926,6 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc)
|
|||||||
case JUMP_IF_FALSE:
|
case JUMP_IF_FALSE:
|
||||||
when = "JUMP_IF_FALSE";
|
when = "JUMP_IF_FALSE";
|
||||||
break;
|
break;
|
||||||
case JUMP_AND_KEEP_IF_FALSE:
|
|
||||||
when = "JUMP_AND_KEEP_IF_FALSE";
|
|
||||||
break;
|
|
||||||
case JUMP_IF_COND_FALSE:
|
case JUMP_IF_COND_FALSE:
|
||||||
when = "JUMP_IF_COND_FALSE";
|
when = "JUMP_IF_COND_FALSE";
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user