mirror of
https://github.com/vim/vim.git
synced 2025-08-29 20:33:37 -04:00
patch 8.2.0493: Vim9: some error messages not tested
Problem: Vim9: some error messages not tested. Solution: Add more tests. Fix uncovered bugs.
This commit is contained in:
parent
a8c1770469
commit
e69f6d044c
@ -2861,6 +2861,7 @@ test_ignore_error({expr}) none ignore a specific error
|
|||||||
test_null_blob() Blob null value for testing
|
test_null_blob() Blob null value for testing
|
||||||
test_null_channel() Channel null value for testing
|
test_null_channel() Channel null value for testing
|
||||||
test_null_dict() Dict null value for testing
|
test_null_dict() Dict null value for testing
|
||||||
|
test_null_function() Funcref null value for testing
|
||||||
test_null_job() Job null value for testing
|
test_null_job() Job null value for testing
|
||||||
test_null_list() List null value for testing
|
test_null_list() List null value for testing
|
||||||
test_null_partial() Funcref null value for testing
|
test_null_partial() Funcref null value for testing
|
||||||
|
@ -106,6 +106,10 @@ test_null_dict() *test_null_dict()*
|
|||||||
Return a |Dict| that is null. Only useful for testing.
|
Return a |Dict| that is null. Only useful for testing.
|
||||||
|
|
||||||
|
|
||||||
|
test_null_function() *test_null_function()*
|
||||||
|
Return a |FuncRef| that is null. Only useful for testing.
|
||||||
|
|
||||||
|
|
||||||
test_null_job() *test_null_job()*
|
test_null_job() *test_null_job()*
|
||||||
Return a |Job| that is null. Only useful for testing.
|
Return a |Job| that is null. Only useful for testing.
|
||||||
{only available when compiled with the +job feature}
|
{only available when compiled with the +job feature}
|
||||||
|
@ -3849,8 +3849,12 @@ tv_equal(
|
|||||||
return tv1->vval.v_channel == tv2->vval.v_channel;
|
return tv1->vval.v_channel == tv2->vval.v_channel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case VAR_FUNC:
|
|
||||||
case VAR_PARTIAL:
|
case VAR_PARTIAL:
|
||||||
|
return tv1->vval.v_partial == tv2->vval.v_partial;
|
||||||
|
|
||||||
|
case VAR_FUNC:
|
||||||
|
return tv1->vval.v_string == tv2->vval.v_string;
|
||||||
|
|
||||||
case VAR_UNKNOWN:
|
case VAR_UNKNOWN:
|
||||||
case VAR_VOID:
|
case VAR_VOID:
|
||||||
break;
|
break;
|
||||||
|
@ -290,7 +290,8 @@ ret_string(int argcount UNUSED, type_T **argtypes UNUSED)
|
|||||||
{
|
{
|
||||||
return &t_string;
|
return &t_string;
|
||||||
}
|
}
|
||||||
static type_T * ret_list_any(int argcount UNUSED, type_T **argtypes UNUSED)
|
static type_T *
|
||||||
|
ret_list_any(int argcount UNUSED, type_T **argtypes UNUSED)
|
||||||
{
|
{
|
||||||
return &t_list_any;
|
return &t_list_any;
|
||||||
}
|
}
|
||||||
@ -330,9 +331,14 @@ ret_blob(int argcount UNUSED, type_T **argtypes UNUSED)
|
|||||||
return &t_blob;
|
return &t_blob;
|
||||||
}
|
}
|
||||||
static type_T *
|
static type_T *
|
||||||
ret_partial_void(int argcount UNUSED, type_T **argtypes UNUSED)
|
ret_func_any(int argcount UNUSED, type_T **argtypes UNUSED)
|
||||||
{
|
{
|
||||||
return &t_partial_void;
|
return &t_func_any;
|
||||||
|
}
|
||||||
|
static type_T *
|
||||||
|
ret_partial_any(int argcount UNUSED, type_T **argtypes UNUSED)
|
||||||
|
{
|
||||||
|
return &t_partial_any;
|
||||||
}
|
}
|
||||||
static type_T *
|
static type_T *
|
||||||
ret_channel(int argcount UNUSED, type_T **argtypes UNUSED)
|
ret_channel(int argcount UNUSED, type_T **argtypes UNUSED)
|
||||||
@ -558,7 +564,7 @@ static funcentry_T global_functions[] =
|
|||||||
{"foldtext", 0, 0, 0, ret_string, f_foldtext},
|
{"foldtext", 0, 0, 0, ret_string, f_foldtext},
|
||||||
{"foldtextresult", 1, 1, FEARG_1, ret_string, f_foldtextresult},
|
{"foldtextresult", 1, 1, FEARG_1, ret_string, f_foldtextresult},
|
||||||
{"foreground", 0, 0, 0, ret_void, f_foreground},
|
{"foreground", 0, 0, 0, ret_void, f_foreground},
|
||||||
{"funcref", 1, 3, FEARG_1, ret_partial_void, f_funcref},
|
{"funcref", 1, 3, FEARG_1, ret_partial_any, f_funcref},
|
||||||
{"function", 1, 3, FEARG_1, ret_f_function, f_function},
|
{"function", 1, 3, FEARG_1, ret_f_function, f_function},
|
||||||
{"garbagecollect", 0, 1, 0, ret_void, f_garbagecollect},
|
{"garbagecollect", 0, 1, 0, ret_void, f_garbagecollect},
|
||||||
{"get", 2, 3, FEARG_1, ret_any, f_get},
|
{"get", 2, 3, FEARG_1, ret_any, f_get},
|
||||||
@ -952,9 +958,10 @@ static funcentry_T global_functions[] =
|
|||||||
{"test_null_blob", 0, 0, 0, ret_blob, f_test_null_blob},
|
{"test_null_blob", 0, 0, 0, ret_blob, f_test_null_blob},
|
||||||
{"test_null_channel", 0, 0, 0, ret_channel, JOB_FUNC(f_test_null_channel)},
|
{"test_null_channel", 0, 0, 0, ret_channel, JOB_FUNC(f_test_null_channel)},
|
||||||
{"test_null_dict", 0, 0, 0, ret_dict_any, f_test_null_dict},
|
{"test_null_dict", 0, 0, 0, ret_dict_any, f_test_null_dict},
|
||||||
|
{"test_null_function", 0, 0, 0, ret_func_any, f_test_null_function},
|
||||||
{"test_null_job", 0, 0, 0, ret_job, JOB_FUNC(f_test_null_job)},
|
{"test_null_job", 0, 0, 0, ret_job, JOB_FUNC(f_test_null_job)},
|
||||||
{"test_null_list", 0, 0, 0, ret_list_any, f_test_null_list},
|
{"test_null_list", 0, 0, 0, ret_list_any, f_test_null_list},
|
||||||
{"test_null_partial", 0, 0, 0, ret_partial_void, f_test_null_partial},
|
{"test_null_partial", 0, 0, 0, ret_partial_any, f_test_null_partial},
|
||||||
{"test_null_string", 0, 0, 0, ret_string, f_test_null_string},
|
{"test_null_string", 0, 0, 0, ret_string, f_test_null_string},
|
||||||
{"test_option_not_set", 1, 1, FEARG_1,ret_void, f_test_option_not_set},
|
{"test_option_not_set", 1, 1, FEARG_1,ret_void, f_test_option_not_set},
|
||||||
{"test_override", 2, 2, FEARG_2, ret_void, f_test_override},
|
{"test_override", 2, 2, FEARG_2, ret_void, f_test_override},
|
||||||
|
@ -26,6 +26,7 @@ void f_test_null_channel(typval_T *argvars, typval_T *rettv);
|
|||||||
void f_test_null_dict(typval_T *argvars, typval_T *rettv);
|
void f_test_null_dict(typval_T *argvars, typval_T *rettv);
|
||||||
void f_test_null_job(typval_T *argvars, typval_T *rettv);
|
void f_test_null_job(typval_T *argvars, typval_T *rettv);
|
||||||
void f_test_null_list(typval_T *argvars, typval_T *rettv);
|
void f_test_null_list(typval_T *argvars, typval_T *rettv);
|
||||||
|
void f_test_null_function(typval_T *argvars, typval_T *rettv);
|
||||||
void f_test_null_partial(typval_T *argvars, typval_T *rettv);
|
void f_test_null_partial(typval_T *argvars, typval_T *rettv);
|
||||||
void f_test_null_string(typval_T *argvars, typval_T *rettv);
|
void f_test_null_string(typval_T *argvars, typval_T *rettv);
|
||||||
void f_test_unknown(typval_T *argvars, typval_T *rettv);
|
void f_test_unknown(typval_T *argvars, typval_T *rettv);
|
||||||
|
@ -117,6 +117,48 @@ def Test_assignment()
|
|||||||
assert_equal('aregadd', @a)
|
assert_equal('aregadd', @a)
|
||||||
call CheckDefFailure(['@a += "more"'], 'E1013:')
|
call CheckDefFailure(['@a += "more"'], 'E1013:')
|
||||||
call CheckDefFailure(['@a += 123'], 'E1013:')
|
call CheckDefFailure(['@a += 123'], 'E1013:')
|
||||||
|
|
||||||
|
v:errmsg = 'none'
|
||||||
|
v:errmsg ..= 'again'
|
||||||
|
assert_equal('noneagain', v:errmsg)
|
||||||
|
call CheckDefFailure(['v:errmsg += "more"'], 'E1013:')
|
||||||
|
call CheckDefFailure(['v:errmsg += 123'], 'E1013:')
|
||||||
|
|
||||||
|
" Test default values.
|
||||||
|
let thebool: bool
|
||||||
|
assert_equal(v:false, thebool)
|
||||||
|
|
||||||
|
let thenumber: number
|
||||||
|
assert_equal(0, thenumber)
|
||||||
|
|
||||||
|
if has('float')
|
||||||
|
let thefloat: float
|
||||||
|
assert_equal(0.0, thefloat)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let thestring: string
|
||||||
|
assert_equal('', thestring)
|
||||||
|
|
||||||
|
let theblob: blob
|
||||||
|
assert_equal(0z, theblob)
|
||||||
|
|
||||||
|
let thefunc: func
|
||||||
|
assert_equal(test_null_function(), thefunc)
|
||||||
|
|
||||||
|
let thepartial: partial
|
||||||
|
assert_equal(test_null_partial(), thepartial)
|
||||||
|
|
||||||
|
let thelist: list<any>
|
||||||
|
assert_equal([], thelist)
|
||||||
|
|
||||||
|
let thedict: dict<any>
|
||||||
|
assert_equal({}, thedict)
|
||||||
|
|
||||||
|
let thejob: job
|
||||||
|
assert_equal(test_null_job(), thejob)
|
||||||
|
|
||||||
|
let thechannel: channel
|
||||||
|
assert_equal(test_null_channel(), thechannel)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
func Test_assignment_failure()
|
func Test_assignment_failure()
|
||||||
@ -129,6 +171,7 @@ func Test_assignment_failure()
|
|||||||
|
|
||||||
call CheckDefFailure(['let [a; b; c] = g:list'], 'E452:')
|
call CheckDefFailure(['let [a; b; c] = g:list'], 'E452:')
|
||||||
|
|
||||||
|
call CheckDefFailure(['let somevar'], "E1022:")
|
||||||
call CheckDefFailure(['let &option'], 'E1052:')
|
call CheckDefFailure(['let &option'], 'E1052:')
|
||||||
call CheckDefFailure(['&g:option = 5'], 'E113:')
|
call CheckDefFailure(['&g:option = 5'], 'E113:')
|
||||||
|
|
||||||
|
@ -882,6 +882,13 @@ f_test_null_list(typval_T *argvars UNUSED, typval_T *rettv)
|
|||||||
rettv_list_set(rettv, NULL);
|
rettv_list_set(rettv, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
f_test_null_function(typval_T *argvars UNUSED, typval_T *rettv)
|
||||||
|
{
|
||||||
|
rettv->v_type = VAR_FUNC;
|
||||||
|
rettv->vval.v_string = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
f_test_null_partial(typval_T *argvars UNUSED, typval_T *rettv)
|
f_test_null_partial(typval_T *argvars UNUSED, typval_T *rettv)
|
||||||
{
|
{
|
||||||
|
@ -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 */
|
||||||
|
/**/
|
||||||
|
493,
|
||||||
/**/
|
/**/
|
||||||
492,
|
492,
|
||||||
/**/
|
/**/
|
||||||
|
@ -766,7 +766,7 @@ generate_PUSHFUNC(cctx_T *cctx, char_u *name)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate an ISN_PUSHPARTIAL instruction with partial "part".
|
* Generate an ISN_PUSHPARTIAL instruction with partial "part".
|
||||||
* Consumes "name".
|
* Consumes "part".
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
generate_PUSHPARTIAL(cctx_T *cctx, partial_T *part)
|
generate_PUSHPARTIAL(cctx_T *cctx, partial_T *part)
|
||||||
@ -3808,9 +3808,6 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
|
|||||||
case VAR_BOOL:
|
case VAR_BOOL:
|
||||||
generate_PUSHBOOL(cctx, VVAL_FALSE);
|
generate_PUSHBOOL(cctx, VVAL_FALSE);
|
||||||
break;
|
break;
|
||||||
case VAR_SPECIAL:
|
|
||||||
generate_PUSHSPEC(cctx, VVAL_NONE);
|
|
||||||
break;
|
|
||||||
case VAR_FLOAT:
|
case VAR_FLOAT:
|
||||||
#ifdef FEAT_FLOAT
|
#ifdef FEAT_FLOAT
|
||||||
generate_PUSHF(cctx, 0.0);
|
generate_PUSHF(cctx, 0.0);
|
||||||
@ -3843,6 +3840,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
|
|||||||
case VAR_NUMBER:
|
case VAR_NUMBER:
|
||||||
case VAR_UNKNOWN:
|
case VAR_UNKNOWN:
|
||||||
case VAR_VOID:
|
case VAR_VOID:
|
||||||
|
case VAR_SPECIAL: // cannot happen
|
||||||
generate_PUSHNR(cctx, 0);
|
generate_PUSHNR(cctx, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -920,7 +920,9 @@ call_def_function(
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
tv->v_type = VAR_STRING;
|
tv->v_type = VAR_STRING;
|
||||||
tv->vval.v_string = vim_strsave(iptr->isn_arg.string);
|
tv->vval.v_string = vim_strsave(
|
||||||
|
iptr->isn_arg.string == NULL
|
||||||
|
? (char_u *)"" : iptr->isn_arg.string);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user