mirror of
				https://github.com/vim/vim.git
				synced 2025-10-30 09:47:20 -04:00 
			
		
		
		
	patch 8.2.4835: Vim9: some lines not covered by tests
Problem: Vim9: some lines not covered by tests. Solution: Add a few more tests. Fix disassemble output.
This commit is contained in:
		| @@ -1691,6 +1691,9 @@ def Test_substitute_expr() | ||||
|   endfor | ||||
|   assert_equal('yes no abc', getline(1)) | ||||
|  | ||||
|   setline(1, 'from') | ||||
|   v9.CheckDefExecFailure(['s/from/\=g:notexist/'], 'E121: Undefined variable: g:notexist') | ||||
|  | ||||
|   bwipe! | ||||
|  | ||||
|   v9.CheckDefFailure(['s/from/\="x")/'], 'E488:') | ||||
|   | ||||
| @@ -899,6 +899,25 @@ def Test_disassemble_closure() | ||||
|   unlet g:Get | ||||
| enddef | ||||
|  | ||||
| def s:ClosureArg(arg: string) | ||||
|   var Ref = () => arg .. "x" | ||||
| enddef | ||||
|  | ||||
| def Test_disassemble_closure_arg() | ||||
|   var res = execute('disass s:ClosureArg') | ||||
|   assert_match('<SNR>\d\+_ClosureArg\_s*' .. | ||||
|         'var Ref = () => arg .. "x"\_s*' .. | ||||
|         '\d FUNCREF <lambda>\d\+', | ||||
|         res) | ||||
|   var lres = execute('disass ' .. matchstr(res, '<lambda>\d\+')) | ||||
|   assert_match('<lambda>\d\+\_s*' .. | ||||
|         'return arg .. "x"\_s*' .. | ||||
|         '\d LOADOUTER level 1 arg\[-1]\_s*' .. | ||||
|         '\d PUSHS "x"\_s*' .. | ||||
|         '\d CONCAT size 2\_s*' .. | ||||
|         '\d RETURN', | ||||
|          lres) | ||||
| enddef | ||||
|  | ||||
| def EchoArg(arg: string): string | ||||
|   return arg | ||||
| @@ -2664,6 +2683,22 @@ def Test_disassemble_dict_stack() | ||||
|         res) | ||||
| enddef | ||||
|  | ||||
| def s:RetLegacy(): string | ||||
|   legacy return "yes" | ||||
| enddef | ||||
|  | ||||
| def Test_disassemble_return_legacy() | ||||
|   var res = execute('disass s:RetLegacy') | ||||
|   assert_match('<SNR>\d*_RetLegacy\_s*' .. | ||||
|           'legacy return "yes"\_s*' .. | ||||
|           '\d CMDMOD legacy\_s*' .. | ||||
|           '\d EVAL legacy "yes"\_s*' .. | ||||
|           '\d CHECKTYPE string stack\[-1]\_s*' .. | ||||
|           '\d CMDMOD_REV\_s*' .. | ||||
|           '\d RETURN', | ||||
|         res) | ||||
| enddef | ||||
|  | ||||
| def s:EchoMessages() | ||||
|   echohl ErrorMsg | echom v:exception | echohl NONE | ||||
| enddef | ||||
|   | ||||
| @@ -2376,6 +2376,14 @@ def Test_for_loop_unpack() | ||||
|       endfor | ||||
|   END | ||||
|   v9.CheckDefExecFailure(lines, 'E1017:', 1) | ||||
|  | ||||
|   lines =<< trim END | ||||
|       for [a, b] in g:listlist | ||||
|         echo a | ||||
|       endfor | ||||
|   END | ||||
|   g:listlist = [1, 2, 3] | ||||
|   v9.CheckDefExecFailure(lines, 'E1140:', 1) | ||||
| enddef | ||||
|  | ||||
| def Test_for_loop_with_try_continue() | ||||
|   | ||||
| @@ -746,6 +746,8 @@ static char *(features[]) = | ||||
|  | ||||
| static int included_patches[] = | ||||
| {   /* Add new patch number below this line */ | ||||
| /**/ | ||||
|     4835, | ||||
| /**/ | ||||
|     4834, | ||||
| /**/ | ||||
|   | ||||
| @@ -5571,7 +5571,7 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc) | ||||
| 		break; | ||||
| 	    case ISN_LOADOUTER: | ||||
| 		{ | ||||
| 		    if (iptr->isn_arg.number < 0) | ||||
| 		    if (iptr->isn_arg.outer.outer_idx < 0) | ||||
| 			smsg("%s%4d LOADOUTER level %d arg[%d]", pfx, current, | ||||
| 				iptr->isn_arg.outer.outer_depth, | ||||
| 				iptr->isn_arg.outer.outer_idx | ||||
|   | ||||
		Reference in New Issue
	
	Block a user