forked from aniani/vim
patch 8.2.0299: Vim9: ISN_STORE with argument not tested
Problem: Vim9: ISN_STORE with argument not tested. Some cases in tv2bool() not tested. Solution: Add tests. Add test_unknown() and test_void().
This commit is contained in:
parent
0c6ceaf903
commit
8ed04587d3
@ -2864,6 +2864,8 @@ 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
|
||||||
test_null_string() String null value for testing
|
test_null_string() String null value for testing
|
||||||
|
test_unknown() any unknown value for testing
|
||||||
|
test_void() any void value for testing
|
||||||
test_option_not_set({name}) none reset flag indicating option was set
|
test_option_not_set({name}) none reset flag indicating option was set
|
||||||
test_override({expr}, {val}) none test with Vim internal overrides
|
test_override({expr}, {val}) none test with Vim internal overrides
|
||||||
test_refcount({expr}) Number get the reference count of {expr}
|
test_refcount({expr}) Number get the reference count of {expr}
|
||||||
|
@ -123,6 +123,13 @@ test_null_string() *test_null_string()*
|
|||||||
Return a |String| that is null. Only useful for testing.
|
Return a |String| that is null. Only useful for testing.
|
||||||
|
|
||||||
|
|
||||||
|
test_unknown() *test_unknown()*
|
||||||
|
Return a value with unknown type. Only useful for testing.
|
||||||
|
|
||||||
|
test_void() *test_void()*
|
||||||
|
Return a value with void type. Only useful for testing.
|
||||||
|
|
||||||
|
|
||||||
test_option_not_set({name}) *test_option_not_set()*
|
test_option_not_set({name}) *test_option_not_set()*
|
||||||
Reset the flag that indicates option {name} was set. Thus it
|
Reset the flag that indicates option {name} was set. Thus it
|
||||||
looks like it still has the default value. Use like this: >
|
looks like it still has the default value. Use like this: >
|
||||||
|
@ -821,6 +821,8 @@ static funcentry_T global_functions[] =
|
|||||||
{"test_setmouse", 2, 2, 0, &t_void, f_test_setmouse},
|
{"test_setmouse", 2, 2, 0, &t_void, f_test_setmouse},
|
||||||
{"test_settime", 1, 1, FEARG_1, &t_void, f_test_settime},
|
{"test_settime", 1, 1, FEARG_1, &t_void, f_test_settime},
|
||||||
{"test_srand_seed", 0, 1, FEARG_1, &t_void, f_test_srand_seed},
|
{"test_srand_seed", 0, 1, FEARG_1, &t_void, f_test_srand_seed},
|
||||||
|
{"test_unknown", 0, 0, 0, &t_any, f_test_unknown},
|
||||||
|
{"test_void", 0, 0, 0, &t_any, f_test_void},
|
||||||
#ifdef FEAT_TIMERS
|
#ifdef FEAT_TIMERS
|
||||||
{"timer_info", 0, 1, FEARG_1, &t_list_dict_any, f_timer_info},
|
{"timer_info", 0, 1, FEARG_1, &t_list_dict_any, f_timer_info},
|
||||||
{"timer_pause", 2, 2, FEARG_1, &t_void, f_timer_pause},
|
{"timer_pause", 2, 2, FEARG_1, &t_void, f_timer_pause},
|
||||||
|
@ -28,6 +28,8 @@ 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_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_void(typval_T *argvars, typval_T *rettv);
|
||||||
void f_test_scrollbar(typval_T *argvars, typval_T *rettv);
|
void f_test_scrollbar(typval_T *argvars, typval_T *rettv);
|
||||||
void f_test_setmouse(typval_T *argvars, typval_T *rettv);
|
void f_test_setmouse(typval_T *argvars, typval_T *rettv);
|
||||||
void f_test_settime(typval_T *argvars, typval_T *rettv);
|
void f_test_settime(typval_T *argvars, typval_T *rettv);
|
||||||
|
@ -221,6 +221,23 @@ def Test_disassemble_call()
|
|||||||
\, res)
|
\, res)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
|
||||||
|
def FuncWithDefault(arg: string = 'default'): string
|
||||||
|
return arg
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def Test_disassemble_call_default()
|
||||||
|
let res = execute('disass FuncWithDefault')
|
||||||
|
assert_match('FuncWithDefault.*'
|
||||||
|
\ .. '\d PUSHS "default".*'
|
||||||
|
\ .. '\d STORE arg\[-1].*'
|
||||||
|
\ .. 'return arg.*'
|
||||||
|
\ .. '\d LOAD arg\[-1].*'
|
||||||
|
\ .. '\d RETURN.*'
|
||||||
|
\, res)
|
||||||
|
enddef
|
||||||
|
|
||||||
|
|
||||||
def HasEval()
|
def HasEval()
|
||||||
if has("eval")
|
if has("eval")
|
||||||
echo "yes"
|
echo "yes"
|
||||||
|
@ -765,6 +765,23 @@ def Test_expr7_not()
|
|||||||
assert_equal(false, ![2])
|
assert_equal(false, ![2])
|
||||||
assert_equal(true, !!'asdf')
|
assert_equal(true, !!'asdf')
|
||||||
assert_equal(true, !![2])
|
assert_equal(true, !![2])
|
||||||
|
|
||||||
|
assert_equal(true, !test_null_partial())
|
||||||
|
assert_equal(false, !{-> 'yes'})
|
||||||
|
|
||||||
|
assert_equal(true, !test_null_dict())
|
||||||
|
assert_equal(true, !{})
|
||||||
|
assert_equal(false, !{'yes': 'no'})
|
||||||
|
|
||||||
|
assert_equal(true, !test_null_job())
|
||||||
|
assert_equal(true, !test_null_channel())
|
||||||
|
|
||||||
|
assert_equal(true, !test_null_blob())
|
||||||
|
assert_equal(true, !0z)
|
||||||
|
assert_equal(false, !0z01)
|
||||||
|
|
||||||
|
assert_equal(true, !test_void())
|
||||||
|
assert_equal(true, !test_unknown())
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
func Test_expr7_fails()
|
func Test_expr7_fails()
|
||||||
|
@ -896,6 +896,18 @@ f_test_null_string(typval_T *argvars UNUSED, typval_T *rettv)
|
|||||||
rettv->vval.v_string = NULL;
|
rettv->vval.v_string = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
f_test_unknown(typval_T *argvars UNUSED, typval_T *rettv)
|
||||||
|
{
|
||||||
|
rettv->v_type = VAR_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
f_test_void(typval_T *argvars UNUSED, typval_T *rettv)
|
||||||
|
{
|
||||||
|
rettv->v_type = VAR_VOID;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
void
|
void
|
||||||
f_test_scrollbar(typval_T *argvars, typval_T *rettv UNUSED)
|
f_test_scrollbar(typval_T *argvars, typval_T *rettv UNUSED)
|
||||||
|
@ -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 */
|
||||||
|
/**/
|
||||||
|
299,
|
||||||
/**/
|
/**/
|
||||||
298,
|
298,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user