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 -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202004021151.032Bpfp0025557%40masaka.moolenaar.net.

Raspunde prin e-mail lui