forked from aniani/vim
patch 8.2.0496: Vim9: disassemble test fails
Problem: Vim9: disassemble test fails. Solution: Separate test cases with recognized constant expressions.
This commit is contained in:
@@ -728,7 +728,6 @@ def Test_disassemble_compare()
|
||||
\ ['111 =~ 222', 'COMPARENR =\~'],
|
||||
\ ['111 !~ 222', 'COMPARENR !\~'],
|
||||
\
|
||||
\ ['"xx" == "yy"', 'COMPARESTRING =='],
|
||||
\ ['"xx" != "yy"', 'COMPARESTRING !='],
|
||||
\ ['"xx" > "yy"', 'COMPARESTRING >'],
|
||||
\ ['"xx" < "yy"', 'COMPARESTRING <'],
|
||||
@@ -806,6 +805,47 @@ def Test_disassemble_compare()
|
||||
delete('Xdisassemble')
|
||||
enddef
|
||||
|
||||
def Test_disassemble_compare_const()
|
||||
let cases = [
|
||||
\ ['"xx" == "yy"', false],
|
||||
\ ['"aa" == "aa"', true],
|
||||
\ ]
|
||||
|
||||
let nr = 1
|
||||
for case in cases
|
||||
writefile(['def TestCase' .. nr .. '()',
|
||||
\ ' if ' .. case[0],
|
||||
\ ' echo 42'
|
||||
\ ' endif',
|
||||
\ 'enddef'], 'Xdisassemble')
|
||||
source Xdisassemble
|
||||
let instr = execute('disassemble TestCase' .. nr)
|
||||
if case[1]
|
||||
" condition true, "echo 42" executed
|
||||
assert_match('TestCase' .. nr .. '.*'
|
||||
\ .. 'if ' .. substitute(case[0], '[[~]', '\\\0', 'g') .. '.*'
|
||||
\ .. '\d PUSHNR 42.*'
|
||||
\ .. '\d ECHO 1.*'
|
||||
\ .. '\d PUSHNR 0.*'
|
||||
\ .. '\d RETURN.*'
|
||||
\, instr)
|
||||
else
|
||||
" condition false, function just returns
|
||||
assert_match('TestCase' .. nr .. '.*'
|
||||
\ .. 'if ' .. substitute(case[0], '[[~]', '\\\0', 'g') .. '[ \n]*'
|
||||
\ .. 'echo 42[ \n]*'
|
||||
\ .. 'endif[ \n]*'
|
||||
\ .. '\s*\d PUSHNR 0.*'
|
||||
\ .. '\d RETURN.*'
|
||||
\, instr)
|
||||
endif
|
||||
|
||||
nr += 1
|
||||
endfor
|
||||
|
||||
delete('Xdisassemble')
|
||||
enddef
|
||||
|
||||
def s:Execute()
|
||||
execute 'help vim9.txt'
|
||||
let cmd = 'help vim9.txt'
|
||||
|
@@ -738,6 +738,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
496,
|
||||
/**/
|
||||
495,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user