comparison src/testdir/test_vim9_disassemble.vim @ 21397:62339482daab v8.2.1249

patch 8.2.1249: Vim9: disassemble test fails Commit: https://github.com/vim/vim/commit/747f11ad6ecad4dd85ce386a0a539cb853fec41a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 19 18:38:37 2020 +0200 patch 8.2.1249: Vim9: disassemble test fails Problem: Vim9: disassemble test fails. Solution: Change INDEX to LISTINDEX. Add test for STRINDEX.
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Jul 2020 18:45:03 +0200
parents fb8c8fcb7b60
children 5cb6e676defd
comparison
equal deleted inserted replaced
21396:f8d5637942ef 21397:62339482daab
896 '\d STORE $.*', 896 '\d STORE $.*',
897 instr) 897 instr)
898 assert_equal('aabb', ConcatString()) 898 assert_equal('aabb', ConcatString())
899 enddef 899 enddef
900 900
901 def StringIndex(): number
902 let s = "abcd"
903 let res = s[1]
904 return res
905 enddef
906
907 def Test_disassemble_string_index()
908 let instr = execute('disassemble StringIndex')
909 assert_match('StringIndex\_s*' ..
910 'let s = "abcd"\_s*' ..
911 '\d PUSHS "abcd"\_s*' ..
912 '\d STORE $0\_s*' ..
913 'let res = s\[1]\_s*' ..
914 '\d LOAD $0\_s*' ..
915 '\d PUSHNR 1\_s*' ..
916 '\d STRINDEX\_s*' ..
917 '\d STORE $1\_s*',
918 instr)
919 assert_equal('b', StringIndex())
920 enddef
921
901 def ListIndex(): number 922 def ListIndex(): number
902 let l = [1, 2, 3] 923 let l = [1, 2, 3]
903 let res = l[1] 924 let res = l[1]
904 return res 925 return res
905 enddef 926 enddef
914 '\d NEWLIST size 3\_s*' .. 935 '\d NEWLIST size 3\_s*' ..
915 '\d STORE $0\_s*' .. 936 '\d STORE $0\_s*' ..
916 'let res = l\[1]\_s*' .. 937 'let res = l\[1]\_s*' ..
917 '\d LOAD $0\_s*' .. 938 '\d LOAD $0\_s*' ..
918 '\d PUSHNR 1\_s*' .. 939 '\d PUSHNR 1\_s*' ..
919 '\d INDEX\_s*' .. 940 '\d LISTINDEX\_s*' ..
920 '\d STORE $1\_s*', 941 '\d STORE $1\_s*',
921 instr) 942 instr)
922 assert_equal(2, ListIndex()) 943 assert_equal(2, ListIndex())
923 enddef 944 enddef
924 945