forked from aniani/vim
		
	patch 8.2.1249: Vim9: disassemble test fails
Problem: Vim9: disassemble test fails. Solution: Change INDEX to LISTINDEX. Add test for STRINDEX.
This commit is contained in:
		| @@ -898,6 +898,27 @@ def Test_disassemble_concat() | |||||||
|   assert_equal('aabb', ConcatString()) |   assert_equal('aabb', ConcatString()) | ||||||
| enddef | 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 | def ListIndex(): number | ||||||
|   let l = [1, 2, 3] |   let l = [1, 2, 3] | ||||||
|   let res = l[1] |   let res = l[1] | ||||||
| @@ -916,7 +937,7 @@ def Test_disassemble_list_index() | |||||||
|         'let res = l\[1]\_s*' .. |         'let res = l\[1]\_s*' .. | ||||||
|         '\d LOAD $0\_s*' .. |         '\d LOAD $0\_s*' .. | ||||||
|         '\d PUSHNR 1\_s*' .. |         '\d PUSHNR 1\_s*' .. | ||||||
|         '\d INDEX\_s*' .. |         '\d LISTINDEX\_s*' .. | ||||||
|         '\d STORE $1\_s*', |         '\d STORE $1\_s*', | ||||||
|         instr) |         instr) | ||||||
|   assert_equal(2, ListIndex()) |   assert_equal(2, ListIndex()) | ||||||
|   | |||||||
| @@ -754,6 +754,8 @@ static char *(features[]) = | |||||||
|  |  | ||||||
| static int included_patches[] = | static int included_patches[] = | ||||||
| {   /* Add new patch number below this line */ | {   /* Add new patch number below this line */ | ||||||
|  | /**/ | ||||||
|  |     1249, | ||||||
| /**/ | /**/ | ||||||
|     1248, |     1248, | ||||||
| /**/ | /**/ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user