]> granicus.if.org Git - vim/commitdiff
patch 8.2.3898: Vim9: not sufficient testing for variable initialization v8.2.3898
authorBram Moolenaar <Bram@vim.org>
Sat, 25 Dec 2021 22:00:49 +0000 (22:00 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 25 Dec 2021 22:00:49 +0000 (22:00 +0000)
Problem:    Vim9: not sufficient testing for variable initialization.
Solution:   Add another test case.

src/testdir/test_vim9_disassemble.vim
src/version.c

index 3b8e12d01b20e7c7b531d00534216739dbc9293e..55a43058419ca65e131ffbc530df6afef4c74f81 100644 (file)
@@ -1802,6 +1802,24 @@ def Test_disassemble_return_bool()
   assert_equal(true, InvertBool())
 enddef
 
+def AutoInit()
+  var t: number
+  t = 1
+  t = 0
+enddef
+
+def Test_disassemble_auto_init()
+  var instr = execute('disassemble AutoInit')
+  assert_match('AutoInit\_s*' ..
+        'var t: number\_s*' ..
+        't = 1\_s*' ..
+        '\d STORE 1 in $0\_s*' ..
+        't = 0\_s*' ..
+        '\d STORE 0 in $0\_s*' ..
+        '\d\+ RETURN void',
+        instr)
+enddef
+
 def Test_disassemble_compare()
   var cases = [
         ['true == isFalse', 'COMPAREBOOL =='],
index adb3722db60bcde959764d322dde9b133db81a09..e41dcb1457700e8075333b2f36ae125f8d119340 100644 (file)
@@ -749,6 +749,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3898,
 /**/
     3897,
 /**/