forked from aniani/vim
patch 8.2.0318: Vim9: types not sufficiently tested
Problem: Vim9: types not sufficiently tested. Solution: Add tests with more types.
This commit is contained in:
@@ -403,10 +403,12 @@ EXTERN type_T t_dict_any INIT4(VAR_DICT, 0, &t_any, NULL);
|
|||||||
EXTERN type_T t_list_empty INIT4(VAR_LIST, 0, &t_void, NULL);
|
EXTERN type_T t_list_empty INIT4(VAR_LIST, 0, &t_void, NULL);
|
||||||
EXTERN type_T t_dict_empty INIT4(VAR_DICT, 0, &t_void, NULL);
|
EXTERN type_T t_dict_empty INIT4(VAR_DICT, 0, &t_void, NULL);
|
||||||
|
|
||||||
|
EXTERN type_T t_list_bool INIT4(VAR_LIST, 0, &t_bool, NULL);
|
||||||
EXTERN type_T t_list_number INIT4(VAR_LIST, 0, &t_number, NULL);
|
EXTERN type_T t_list_number INIT4(VAR_LIST, 0, &t_number, NULL);
|
||||||
EXTERN type_T t_list_string INIT4(VAR_LIST, 0, &t_string, NULL);
|
EXTERN type_T t_list_string INIT4(VAR_LIST, 0, &t_string, NULL);
|
||||||
EXTERN type_T t_list_dict_any INIT4(VAR_LIST, 0, &t_dict_any, NULL);
|
EXTERN type_T t_list_dict_any INIT4(VAR_LIST, 0, &t_dict_any, NULL);
|
||||||
|
|
||||||
|
EXTERN type_T t_dict_bool INIT4(VAR_DICT, 0, &t_bool, NULL);
|
||||||
EXTERN type_T t_dict_number INIT4(VAR_DICT, 0, &t_number, NULL);
|
EXTERN type_T t_dict_number INIT4(VAR_DICT, 0, &t_number, NULL);
|
||||||
EXTERN type_T t_dict_string INIT4(VAR_DICT, 0, &t_string, NULL);
|
EXTERN type_T t_dict_string INIT4(VAR_DICT, 0, &t_string, NULL);
|
||||||
|
|
||||||
|
@@ -861,4 +861,8 @@ func Test_expr_fails()
|
|||||||
call CheckDefExecFailure("CallMe ('yes')", 'E492:')
|
call CheckDefExecFailure("CallMe ('yes')", 'E492:')
|
||||||
call CheckDefFailure("CallMe2('yes','no')", 'E1069:')
|
call CheckDefFailure("CallMe2('yes','no')", 'E1069:')
|
||||||
call CheckDefFailure("CallMe2('yes' , 'no')", 'E1068:')
|
call CheckDefFailure("CallMe2('yes' , 'no')", 'E1068:')
|
||||||
|
|
||||||
|
call CheckDefFailure("v:nosuch += 3", 'E1001:')
|
||||||
|
call CheckDefFailure("let v:version = 3", 'E1064:')
|
||||||
|
call CheckDefFailure("let asdf = v:nosuch", 'E1001:')
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -37,14 +37,20 @@ def Test_assignment()
|
|||||||
let bool2: bool = false
|
let bool2: bool = false
|
||||||
assert_equal(v:false, bool2)
|
assert_equal(v:false, bool2)
|
||||||
|
|
||||||
let list1: list<string> = ['sdf', 'asdf']
|
let list1: list<bool> = [false, true, false]
|
||||||
let list2: list<number> = [1, 2, 3]
|
let list2: list<number> = [1, 2, 3]
|
||||||
|
let list3: list<string> = ['sdf', 'asdf']
|
||||||
|
let list4: list<any> = ['yes', true, 1234]
|
||||||
|
let list5: list<blob> = [0z01, 0z02]
|
||||||
|
|
||||||
let listS: list<string> = []
|
let listS: list<string> = []
|
||||||
let listN: list<number> = []
|
let listN: list<number> = []
|
||||||
|
|
||||||
let dict1: dict<string> = #{key: 'value'}
|
let dict1: dict<bool> = #{one: false, two: true}
|
||||||
let dict2: dict<number> = #{one: 1, two: 2}
|
let dict2: dict<number> = #{one: 1, two: 2}
|
||||||
|
let dict3: dict<string> = #{key: 'value'}
|
||||||
|
let dict4: dict<any> = #{one: 1, two: '2'}
|
||||||
|
let dict5: dict<blob> = #{one: 0z01, tw: 0z02}
|
||||||
|
|
||||||
g:newvar = 'new'
|
g:newvar = 'new'
|
||||||
assert_equal('new', g:newvar)
|
assert_equal('new', g:newvar)
|
||||||
|
@@ -738,6 +738,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 */
|
||||||
|
/**/
|
||||||
|
318,
|
||||||
/**/
|
/**/
|
||||||
317,
|
317,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -213,6 +213,8 @@ get_list_type(type_T *member_type, garray_T *type_list)
|
|||||||
return &t_list_any;
|
return &t_list_any;
|
||||||
if (member_type->tt_type == VAR_VOID)
|
if (member_type->tt_type == VAR_VOID)
|
||||||
return &t_list_empty;
|
return &t_list_empty;
|
||||||
|
if (member_type->tt_type == VAR_BOOL)
|
||||||
|
return &t_list_bool;
|
||||||
if (member_type->tt_type == VAR_NUMBER)
|
if (member_type->tt_type == VAR_NUMBER)
|
||||||
return &t_list_number;
|
return &t_list_number;
|
||||||
if (member_type->tt_type == VAR_STRING)
|
if (member_type->tt_type == VAR_STRING)
|
||||||
@@ -238,6 +240,8 @@ get_dict_type(type_T *member_type, garray_T *type_list)
|
|||||||
return &t_dict_any;
|
return &t_dict_any;
|
||||||
if (member_type->tt_type == VAR_VOID)
|
if (member_type->tt_type == VAR_VOID)
|
||||||
return &t_dict_empty;
|
return &t_dict_empty;
|
||||||
|
if (member_type->tt_type == VAR_BOOL)
|
||||||
|
return &t_dict_bool;
|
||||||
if (member_type->tt_type == VAR_NUMBER)
|
if (member_type->tt_type == VAR_NUMBER)
|
||||||
return &t_dict_number;
|
return &t_dict_number;
|
||||||
if (member_type->tt_type == VAR_STRING)
|
if (member_type->tt_type == VAR_STRING)
|
||||||
|
Reference in New Issue
Block a user