mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.1009: Vim9: some failures not checked for
Problem: Vim9: some failures not checked for. Solution: Add test cases. Remove unused code.
This commit is contained in:
parent
0779fab297
commit
c5b1c20b6b
@ -127,6 +127,7 @@ def Test_assignment_list()
|
||||
list2[-3] = 77
|
||||
assert_equal([77, 88, 99], list2)
|
||||
call CheckDefExecFailure(['let ll = [1, 2, 3]', 'll[-4] = 6'], 'E684:')
|
||||
call CheckDefExecFailure(['let [v1, v2] = [1, 2]'], 'E1092:')
|
||||
|
||||
# type becomes list<any>
|
||||
let somelist = rand() > 0 ? [1, 2, 3] : ['a', 'b', 'c']
|
||||
@ -1920,6 +1921,20 @@ def Test_let_declaration()
|
||||
unlet g:other_var
|
||||
enddef
|
||||
|
||||
def Test_let_declaration_fails()
|
||||
let lines =<< trim END
|
||||
vim9script
|
||||
const var: string
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1021:')
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
let 9var: string
|
||||
END
|
||||
CheckScriptFailure(lines, 'E475:')
|
||||
enddef
|
||||
|
||||
def Test_let_type_check()
|
||||
let lines =<< trim END
|
||||
vim9script
|
||||
@ -1933,6 +1948,12 @@ def Test_let_type_check()
|
||||
let var:string
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1069:')
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
let var: asdf
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1010:')
|
||||
enddef
|
||||
|
||||
def Test_forward_declaration()
|
||||
|
@ -754,6 +754,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1009,
|
||||
/**/
|
||||
1008,
|
||||
/**/
|
||||
|
@ -2119,12 +2119,8 @@ call_def_function(
|
||||
list_T *list;
|
||||
int count = iptr->isn_arg.number;
|
||||
|
||||
// type will have been checked to be a list
|
||||
tv = STACK_TV_BOT(-1);
|
||||
if (tv->v_type != VAR_LIST)
|
||||
{
|
||||
emsg(_(e_listreq));
|
||||
goto failed;
|
||||
}
|
||||
list = tv->vval.v_list;
|
||||
|
||||
// no error for short list, expect it to be checked earlier
|
||||
|
Loading…
x
Reference in New Issue
Block a user