]> granicus.if.org Git - vim/commitdiff
patch 8.2.1249: Vim9: disassemble test fails v8.2.1249
authorBram Moolenaar <Bram@vim.org>
Sun, 19 Jul 2020 16:38:37 +0000 (18:38 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 19 Jul 2020 16:38:37 +0000 (18:38 +0200)
Problem:    Vim9: disassemble test fails.
Solution:   Change INDEX to LISTINDEX.  Add test for STRINDEX.

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

index 186ce6d1c6e871071cc4242b87c2403d5e9777fe..3448d8557e1211965b6b1255cdc5dd1606b03785 100644 (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())
index e80df76e105433528936b6a44e46811cacd0899a..6ffb98db553f62616cb82a276ac85d95c3e78b7c 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1249,
 /**/
     1248,
 /**/