0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.1249: Vim9: disassemble test fails

Problem:    Vim9: disassemble test fails.
Solution:   Change INDEX to LISTINDEX.  Add test for STRINDEX.
This commit is contained in:
Bram Moolenaar 2020-07-19 18:38:37 +02:00
parent 956501594e
commit 747f11ad6e
2 changed files with 24 additions and 1 deletions

View File

@ -898,6 +898,27 @@ def Test_disassemble_concat()
assert_equal('aabb', ConcatString())
enddef
def StringIndex(): number
let s = "abcd"
let res = s[1]
return res
enddef
def Test_disassemble_string_index()
let instr = execute('disassemble StringIndex')
assert_match('StringIndex\_s*' ..
'let s = "abcd"\_s*' ..
'\d PUSHS "abcd"\_s*' ..
'\d STORE $0\_s*' ..
'let res = s\[1]\_s*' ..
'\d LOAD $0\_s*' ..
'\d PUSHNR 1\_s*' ..
'\d STRINDEX\_s*' ..
'\d STORE $1\_s*',
instr)
assert_equal('b', StringIndex())
enddef
def ListIndex(): number
let l = [1, 2, 3]
let res = l[1]
@ -916,7 +937,7 @@ def Test_disassemble_list_index()
'let res = l\[1]\_s*' ..
'\d LOAD $0\_s*' ..
'\d PUSHNR 1\_s*' ..
'\d INDEX\_s*' ..
'\d LISTINDEX\_s*' ..
'\d STORE $1\_s*',
instr)
assert_equal(2, ListIndex())

View File

@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1249,
/**/
1248,
/**/