Patch 8.2.0496

10 views
Skip to first unread message

Bram Moolenaar

unread,
Apr 2, 2020, 7:51:50 AM4/2/20
to vim...@googlegroups.com

Patch 8.2.0496
Problem: Vim9: disassemble test fails.
Solution: Separate test cases with recognized constant expressions.
Files: src/testdir/test_vim9_disassemble.vim


*** ../vim-8.2.0495/src/testdir/test_vim9_disassemble.vim 2020-03-31 23:13:05.762568650 +0200
--- src/testdir/test_vim9_disassemble.vim 2020-04-02 13:47:39.164750567 +0200
***************
*** 728,734 ****
\ ['111 =~ 222', 'COMPARENR =\~'],
\ ['111 !~ 222', 'COMPARENR !\~'],
\
- \ ['"xx" == "yy"', 'COMPARESTRING =='],
\ ['"xx" != "yy"', 'COMPARESTRING !='],
\ ['"xx" > "yy"', 'COMPARESTRING >'],
\ ['"xx" < "yy"', 'COMPARESTRING <'],
--- 728,733 ----
***************
*** 802,807 ****
--- 801,847 ----

nr += 1
endfor
+
+ 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
*** ../vim-8.2.0495/src/version.c 2020-04-01 23:05:15.275595403 +0200
--- src/version.c 2020-04-02 13:49:06.468363484 +0200
***************
*** 740,741 ****
--- 740,743 ----
{ /* Add new patch number below this line */
+ /**/
+ 496,
/**/

--
BROTHER MAYNARD: Armaments Chapter Two Verses Nine to Twenty One.
ANOTHER MONK: And St. Attila raised his hand grenade up on high saying "O
Lord bless this thy hand grenade that with it thou mayest
blow thine enemies to tiny bits, in thy mercy. "and the Lord
did grin and people did feast upon the lambs and sloths and
carp and anchovies and orang-utans and breakfast cereals and
fruit bats and...
BROTHER MAYNARD: Skip a bit brother ...
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages