return check_arg_type(&t_dict_any, type, context);
}
+/*
+ * Check "type" is a list of 'any'.
+ */
+ static int
+arg_list_any(type_T *type, argcontext_T *context)
+{
+ return check_arg_type(&t_list_any, type, context);
+}
+
/*
* Check "type" is a list of numbers.
*/
static int
arg_bool(type_T *type, argcontext_T *context)
{
- if (type->tt_type == VAR_ANY
- || type->tt_type == VAR_NUMBER || type->tt_type == VAR_BOOL)
- return OK;
return check_arg_type(&t_bool, type, context);
}
}
/*
- * Check "type" is a list or a dict.
+ * Check "type" is a list of 'any' or a dict of 'any'.
*/
static int
arg_list_or_dict(type_T *type, argcontext_T *context)
return FAIL;
}
+/*
+ * Check "type" is a job.
+ */
+ static int
+arg_job(type_T *type, argcontext_T *context)
+{
+ return check_arg_type(&t_job, type, context);
+}
+
/*
* Check "type" is a channel or a job.
*/
static int
arg_chan_or_job(type_T *type, argcontext_T *context)
{
- if (type->tt_type == VAR_CHANNEL || type->tt_type == VAR_JOB)
+ if (type->tt_type == VAR_ANY ||
+ type->tt_type == VAR_CHANNEL || type->tt_type == VAR_JOB)
return OK;
arg_type_mismatch(&t_channel, type, context->arg_idx + 1);
return FAIL;
/*
* Lists of functions that check the argument types of a builtin function.
*/
-argcheck_T arg1_string[] = {arg_string};
-argcheck_T arg1_number[] = {arg_number};
-argcheck_T arg1_dict[] = {arg_dict_any};
-argcheck_T arg1_list_nr[] = {arg_list_number};
-argcheck_T arg1_list_string[] = {arg_list_string};
-argcheck_T arg1_float_or_nr[] = {arg_float_or_nr};
-argcheck_T arg1_string_or_nr[] = {arg_string_or_nr};
-argcheck_T arg1_string_or_list_any[] = {arg_string_or_list_any};
-argcheck_T arg1_string_or_list_string[] = {arg_string_or_list_string};
-argcheck_T arg1_list_or_blob[] = {arg_list_or_blob};
-argcheck_T arg1_chan_or_job[] = {arg_chan_or_job};
-argcheck_T arg2_float_or_nr[] = {arg_float_or_nr, arg_float_or_nr};
-argcheck_T arg2_number[] = {arg_number, arg_number};
-argcheck_T arg2_string[] = {arg_string, arg_string};
-argcheck_T arg2_list_nr[] = {arg_list_number, arg_list_number};
-argcheck_T arg2_dict_string[] = {arg_dict_any, arg_string};
-argcheck_T arg2_dict_string_or_nr[] = {arg_dict_any, arg_string_or_nr};
-argcheck_T arg2_string_dict[] = {arg_string, arg_dict_any};
-argcheck_T arg2_listblob_item[] = {arg_list_or_blob, arg_item_of_prev};
-argcheck_T arg2_str_or_nr_or_list_dict[] = {arg_str_or_nr_or_list, arg_dict_any};
-argcheck_T arg2_string_or_list_dict[] = {arg_string_or_list_any, arg_dict_any};
-argcheck_T arg3_string[] = {arg_string, arg_string, arg_string};
-argcheck_T arg3_number[] = {arg_number, arg_number, arg_number};
-argcheck_T arg3_string_nr_bool[] = {arg_string, arg_number, arg_bool};
-argcheck_T arg3_string_string_nr[] = {arg_string, arg_string, arg_number};
-argcheck_T arg2_execute[] = {arg_string_or_list_string, arg_string};
-argcheck_T arg23_win_execute[] = {arg_number, arg_string_or_list_string, arg_string};
-argcheck_T arg2_setline[] = {arg_string_or_nr, arg_string_or_list_any};
-argcheck_T arg3_setbufline[] = {arg_string_or_nr, arg_string_or_nr, arg_string_or_list_any};
-argcheck_T arg23_extend[] = {arg_list_or_dict, arg_same_as_prev, arg_extend3};
-argcheck_T arg23_extendnew[] = {arg_list_or_dict, arg_same_struct_as_prev, arg_extend3};
-argcheck_T arg3_insert[] = {arg_list_or_blob, arg_item_of_prev, arg_number};
+static argcheck_T arg1_string[] = {arg_string};
+static argcheck_T arg1_number[] = {arg_number};
+static argcheck_T arg1_bool[] = {arg_bool};
+static argcheck_T arg1_dict_any[] = {arg_dict_any};
+static argcheck_T arg1_job[] = {arg_job};
+static argcheck_T arg1_list_any[] = {arg_list_any};
+static argcheck_T arg1_list_nr[] = {arg_list_number};
+static argcheck_T arg1_list_string[] = {arg_list_string};
+static argcheck_T arg1_float_or_nr[] = {arg_float_or_nr};
+static argcheck_T arg1_string_or_nr[] = {arg_string_or_nr};
+static argcheck_T arg1_string_or_list_any[] = {arg_string_or_list_any};
+static argcheck_T arg1_string_or_list_string[] = {arg_string_or_list_string};
+static argcheck_T arg1_list_or_blob[] = {arg_list_or_blob};
+static argcheck_T arg1_list_or_dict[] = {arg_list_or_dict};
+static argcheck_T arg1_chan_or_job[] = {arg_chan_or_job};
+static argcheck_T arg2_float_or_nr[] = {arg_float_or_nr, arg_float_or_nr};
+static argcheck_T arg2_number[] = {arg_number, arg_number};
+static argcheck_T arg2_string[] = {arg_string, arg_string};
+static argcheck_T arg2_list_nr[] = {arg_list_number, arg_list_number};
+static argcheck_T arg2_nr_string[] = {arg_number, arg_string};
+static argcheck_T arg2_dict_string[] = {arg_dict_any, arg_string};
+static argcheck_T arg2_dict_string_or_nr[] = {arg_dict_any, arg_string_or_nr};
+static argcheck_T arg2_string_dict[] = {arg_string, arg_dict_any};
+static argcheck_T arg2_string_nr[] = {arg_string, arg_number};
+//static argcheck_T arg2_listblob_item[] = {arg_list_or_blob, arg_item_of_prev};
+static argcheck_T arg2_str_or_nr_or_list_dict[] = {arg_str_or_nr_or_list, arg_dict_any};
+static argcheck_T arg2_string_or_list_dict[] = {arg_string_or_list_any, arg_dict_any};
+static argcheck_T arg2_chan_or_job_dict[] = {arg_chan_or_job, arg_dict_any};
+static argcheck_T arg2_nr_dict_any[] = {arg_number, arg_dict_any};
+//static argcheck_T arg2_string_number[] = {arg_string, arg_number};
+static argcheck_T arg3_string[] = {arg_string, arg_string, arg_string};
+static argcheck_T arg3_number[] = {arg_number, arg_number, arg_number};
+static argcheck_T arg3_string_nr_bool[] = {arg_string, arg_number, arg_bool};
+static argcheck_T arg3_string_string_nr[] = {arg_string, arg_string, arg_number};
+static argcheck_T arg2_execute[] = {arg_string_or_list_string, arg_string};
+static argcheck_T arg23_win_execute[] = {arg_number, arg_string_or_list_string, arg_string};
+static argcheck_T arg2_setline[] = {arg_string_or_nr, NULL};
+static argcheck_T arg3_setbufline[] = {arg_string_or_nr, arg_string_or_nr, arg_str_or_nr_or_list};
+static argcheck_T arg23_extend[] = {arg_list_or_dict, arg_same_as_prev, arg_extend3};
+static argcheck_T arg23_extendnew[] = {arg_list_or_dict, arg_same_struct_as_prev, arg_extend3};
+static argcheck_T arg3_insert[] = {arg_list_or_blob, arg_item_of_prev, arg_number};
/*
* Functions that return the return type of a builtin function.
ret_first_arg, f_add},
{"and", 2, 2, FEARG_1, arg2_number,
ret_number, f_and},
- {"append", 2, 2, FEARG_2, NULL,
+ {"append", 2, 2, FEARG_2, arg2_setline,
ret_number_bool, f_append},
- {"appendbufline", 3, 3, FEARG_3, NULL,
+ {"appendbufline", 3, 3, FEARG_3, arg3_setbufline,
ret_number_bool, f_appendbufline},
{"argc", 0, 1, 0, arg1_number,
ret_number, f_argc},
ret_argv, f_argv},
{"asin", 1, 1, FEARG_1, arg1_float_or_nr,
ret_float, FLOAT_FUNC(f_asin)},
- {"assert_beeps", 1, 2, FEARG_1, NULL,
+ {"assert_beeps", 1, 1, FEARG_1, arg1_string,
ret_number_bool, f_assert_beeps},
{"assert_equal", 2, 3, FEARG_2, NULL,
ret_number_bool, f_assert_equal},
ret_number_bool, f_assert_inrange},
{"assert_match", 2, 3, FEARG_2, arg3_string,
ret_number_bool, f_assert_match},
- {"assert_nobeep", 1, 2, FEARG_1, NULL,
+ {"assert_nobeep", 1, 1, FEARG_1, arg1_string,
ret_number_bool, f_assert_nobeep},
{"assert_notequal", 2, 3, FEARG_2, NULL,
ret_number_bool, f_assert_notequal},
ret_number, f_bufwinnr},
{"byte2line", 1, 1, FEARG_1, arg1_number,
ret_number, f_byte2line},
- {"byteidx", 2, 2, FEARG_1, NULL,
+ {"byteidx", 2, 2, FEARG_1, arg2_string_nr,
ret_number, f_byteidx},
- {"byteidxcomp", 2, 2, FEARG_1, NULL,
+ {"byteidxcomp", 2, 2, FEARG_1, arg2_string_nr,
ret_number, f_byteidxcomp},
{"call", 2, 3, FEARG_1, NULL,
ret_any, f_call},
ret_any, JOB_FUNC(f_ch_evalraw)},
{"ch_getbufnr", 2, 2, FEARG_1, NULL,
ret_number, JOB_FUNC(f_ch_getbufnr)},
- {"ch_getjob", 1, 1, FEARG_1, NULL,
+ {"ch_getjob", 1, 1, FEARG_1, arg1_chan_or_job,
ret_job, JOB_FUNC(f_ch_getjob)},
{"ch_info", 1, 1, FEARG_1, arg1_chan_or_job,
ret_dict_any, JOB_FUNC(f_ch_info)},
ret_void, JOB_FUNC(f_ch_logfile)},
{"ch_open", 1, 2, FEARG_1, arg2_string_dict,
ret_channel, JOB_FUNC(f_ch_open)},
- {"ch_read", 1, 2, FEARG_1, NULL,
+ {"ch_read", 1, 2, FEARG_1, arg2_chan_or_job_dict,
ret_string, JOB_FUNC(f_ch_read)},
- {"ch_readblob", 1, 2, FEARG_1, NULL,
+ {"ch_readblob", 1, 2, FEARG_1, arg2_chan_or_job_dict,
ret_blob, JOB_FUNC(f_ch_readblob)},
- {"ch_readraw", 1, 2, FEARG_1, NULL,
+ {"ch_readraw", 1, 2, FEARG_1, arg2_chan_or_job_dict,
ret_string, JOB_FUNC(f_ch_readraw)},
{"ch_sendexpr", 2, 3, FEARG_1, NULL,
ret_void, JOB_FUNC(f_ch_sendexpr)},
{"ch_sendraw", 2, 3, FEARG_1, NULL,
ret_void, JOB_FUNC(f_ch_sendraw)},
- {"ch_setoptions", 2, 2, FEARG_1, NULL,
+ {"ch_setoptions", 2, 2, FEARG_1, arg2_chan_or_job_dict,
ret_void, JOB_FUNC(f_ch_setoptions)},
- {"ch_status", 1, 2, FEARG_1, NULL,
+ {"ch_status", 1, 2, FEARG_1, arg2_chan_or_job_dict,
ret_string, JOB_FUNC(f_ch_status)},
{"changenr", 0, 0, 0, NULL,
ret_number, f_changenr},
ret_number, f_diff_filler},
{"diff_hlID", 2, 2, FEARG_1, NULL,
ret_number, f_diff_hlID},
- {"echoraw", 1, 1, FEARG_1, NULL,
+ {"echoraw", 1, 1, FEARG_1, arg1_string,
ret_void, f_echoraw},
{"empty", 1, 1, FEARG_1, NULL,
ret_number_bool, f_empty},
ret_func_any, f_funcref},
{"function", 1, 3, FEARG_1, NULL,
ret_f_function, f_function},
- {"garbagecollect", 0, 1, 0, NULL,
+ {"garbagecollect", 0, 1, 0, arg1_bool,
ret_void, f_garbagecollect},
{"get", 2, 3, FEARG_1, NULL,
ret_any, f_get},
ret_any, f_getbufvar},
{"getchangelist", 0, 1, FEARG_1, arg1_string_or_nr,
ret_list_any, f_getchangelist},
- {"getchar", 0, 1, 0, NULL,
+ {"getchar", 0, 1, 0, arg1_bool,
ret_any, f_getchar},
{"getcharmod", 0, 0, 0, NULL,
ret_number, f_getcharmod},
- {"getcharpos", 1, 1, FEARG_1, NULL,
+ {"getcharpos", 1, 1, FEARG_1, arg1_string,
ret_list_number, f_getcharpos},
{"getcharsearch", 0, 0, 0, NULL,
ret_dict_any, f_getcharsearch},
- {"getcharstr", 0, 1, 0, NULL,
+ {"getcharstr", 0, 1, 0, arg1_bool,
ret_string, f_getcharstr},
{"getcmdline", 0, 0, 0, NULL,
ret_string, f_getcmdline},
ret_list_any, f_getjumplist},
{"getline", 1, 2, FEARG_1, NULL,
ret_f_getline, f_getline},
- {"getloclist", 1, 2, 0, NULL,
+ {"getloclist", 1, 2, 0, arg2_nr_dict_any,
ret_list_or_dict_1, f_getloclist},
{"getmarklist", 0, 1, FEARG_1, arg1_string_or_nr,
ret_list_dict_any, f_getmarklist},
ret_number, f_getpid},
{"getpos", 1, 1, FEARG_1, arg1_string,
ret_list_number, f_getpos},
- {"getqflist", 0, 1, 0, arg1_dict,
+ {"getqflist", 0, 1, 0, arg1_dict_any,
ret_list_or_dict_0, f_getqflist},
{"getreg", 0, 3, FEARG_1, NULL,
ret_getreg, f_getreg},
ret_number_bool, f_histadd},
{"histdel", 1, 2, FEARG_1, NULL,
ret_number_bool, f_histdel},
- {"histget", 1, 2, FEARG_1, NULL,
+ {"histget", 1, 2, FEARG_1, arg2_string_nr,
ret_string, f_histget},
{"histnr", 1, 1, FEARG_1, arg1_string,
ret_number, f_histnr},
ret_number_bool, f_isdirectory},
{"isinf", 1, 1, FEARG_1, arg1_float_or_nr,
ret_number, MATH_FUNC(f_isinf)},
- {"islocked", 1, 1, FEARG_1, NULL,
+ {"islocked", 1, 1, FEARG_1, arg1_string,
ret_number_bool, f_islocked},
{"isnan", 1, 1, FEARG_1, arg1_float_or_nr,
ret_number_bool, MATH_FUNC(f_isnan)},
- {"items", 1, 1, FEARG_1, arg1_dict,
+ {"items", 1, 1, FEARG_1, arg1_dict_any,
ret_list_items, f_items},
- {"job_getchannel", 1, 1, FEARG_1, NULL,
+ {"job_getchannel", 1, 1, FEARG_1, arg1_job,
ret_channel, JOB_FUNC(f_job_getchannel)},
- {"job_info", 0, 1, FEARG_1, NULL,
+ {"job_info", 0, 1, FEARG_1, arg1_job,
ret_job_info, JOB_FUNC(f_job_info)},
{"job_setoptions", 2, 2, FEARG_1, NULL,
ret_void, JOB_FUNC(f_job_setoptions)},
{"job_start", 1, 2, FEARG_1, NULL,
ret_job, JOB_FUNC(f_job_start)},
- {"job_status", 1, 1, FEARG_1, NULL,
+ {"job_status", 1, 1, FEARG_1, arg1_job,
ret_string, JOB_FUNC(f_job_status)},
{"job_stop", 1, 2, FEARG_1, NULL,
ret_number_bool, JOB_FUNC(f_job_stop)},
ret_any, f_json_decode},
{"json_encode", 1, 1, FEARG_1, NULL,
ret_string, f_json_encode},
- {"keys", 1, 1, FEARG_1, arg1_dict,
+ {"keys", 1, 1, FEARG_1, arg1_dict_any,
ret_list_string, f_keys},
{"last_buffer_nr", 0, 0, 0, arg1_string_or_nr, // obsolete
ret_number, f_last_buffer_nr},
ret_string, f_libcall},
{"libcallnr", 3, 3, FEARG_3, NULL,
ret_number, f_libcallnr},
- {"line", 1, 2, FEARG_1, NULL,
+ {"line", 1, 2, FEARG_1, arg2_string_nr,
ret_number, f_line},
{"line2byte", 1, 1, FEARG_1, arg1_string_or_nr,
ret_number, f_line2byte},
ret_string, f_matchstr},
{"matchstrpos", 2, 4, FEARG_1, NULL,
ret_list_any, f_matchstrpos},
- {"max", 1, 1, FEARG_1, NULL,
+ {"max", 1, 1, FEARG_1, arg1_list_or_dict,
ret_number, f_max},
{"menu_info", 1, 2, FEARG_1, arg2_string,
ret_dict_any,
NULL
#endif
},
- {"min", 1, 1, FEARG_1, NULL,
+ {"min", 1, 1, FEARG_1, arg1_list_or_dict,
ret_number, f_min},
{"mkdir", 1, 3, FEARG_1, arg3_string_string_nr,
ret_number_bool, f_mkdir},
- {"mode", 0, 1, FEARG_1, NULL,
+ {"mode", 0, 1, FEARG_1, arg1_bool,
ret_string, f_mode},
- {"mzeval", 1, 1, FEARG_1, NULL,
+ {"mzeval", 1, 1, FEARG_1, arg1_string,
ret_any,
#ifdef FEAT_MZSCHEME
f_mzeval
ret_string, f_nr2char},
{"or", 2, 2, FEARG_1, arg2_number,
ret_number, f_or},
- {"pathshorten", 1, 2, FEARG_1, NULL,
+ {"pathshorten", 1, 2, FEARG_1, arg2_string_nr,
ret_string, f_pathshorten},
- {"perleval", 1, 1, FEARG_1, NULL,
+ {"perleval", 1, 1, FEARG_1, arg1_string,
ret_any,
#ifdef FEAT_PERL
f_perleval
ret_number, PROP_FUNC(f_popup_atcursor)},
{"popup_beval", 2, 2, FEARG_1, arg2_str_or_nr_or_list_dict,
ret_number, PROP_FUNC(f_popup_beval)},
- {"popup_clear", 0, 1, 0, NULL,
+ {"popup_clear", 0, 1, 0, arg1_bool,
ret_void, PROP_FUNC(f_popup_clear)},
{"popup_close", 1, 2, FEARG_1, NULL,
ret_void, PROP_FUNC(f_popup_close)},
ret_number, PROP_FUNC(f_popup_create)},
{"popup_dialog", 2, 2, FEARG_1, arg2_str_or_nr_or_list_dict,
ret_number, PROP_FUNC(f_popup_dialog)},
- {"popup_filter_menu", 2, 2, 0, NULL,
+ {"popup_filter_menu", 2, 2, 0, arg2_nr_string,
ret_bool, PROP_FUNC(f_popup_filter_menu)},
- {"popup_filter_yesno", 2, 2, 0, NULL,
+ {"popup_filter_yesno", 2, 2, 0, arg2_nr_string,
ret_bool, PROP_FUNC(f_popup_filter_yesno)},
{"popup_findinfo", 0, 0, 0, NULL,
ret_number, PROP_FUNC(f_popup_findinfo)},
{"popup_findpreview", 0, 0, 0, NULL,
ret_number, PROP_FUNC(f_popup_findpreview)},
- {"popup_getoptions", 1, 1, FEARG_1, NULL,
+ {"popup_getoptions", 1, 1, FEARG_1, arg1_number,
ret_dict_any, PROP_FUNC(f_popup_getoptions)},
- {"popup_getpos", 1, 1, FEARG_1, NULL,
+ {"popup_getpos", 1, 1, FEARG_1, arg1_number,
ret_dict_any, PROP_FUNC(f_popup_getpos)},
- {"popup_hide", 1, 1, FEARG_1, NULL,
+ {"popup_hide", 1, 1, FEARG_1, arg1_number,
ret_void, PROP_FUNC(f_popup_hide)},
{"popup_list", 0, 0, 0, NULL,
ret_list_number, PROP_FUNC(f_popup_list)},
ret_number, PROP_FUNC(f_popup_locate)},
{"popup_menu", 2, 2, FEARG_1, arg2_str_or_nr_or_list_dict,
ret_number, PROP_FUNC(f_popup_menu)},
- {"popup_move", 2, 2, FEARG_1, NULL,
+ {"popup_move", 2, 2, FEARG_1, arg2_nr_dict_any,
ret_void, PROP_FUNC(f_popup_move)},
{"popup_notification", 2, 2, FEARG_1, arg2_str_or_nr_or_list_dict,
ret_number, PROP_FUNC(f_popup_notification)},
- {"popup_setoptions", 2, 2, FEARG_1, NULL,
+ {"popup_setoptions", 2, 2, FEARG_1, arg2_nr_dict_any,
ret_void, PROP_FUNC(f_popup_setoptions)},
{"popup_settext", 2, 2, FEARG_1, NULL,
ret_void, PROP_FUNC(f_popup_settext)},
- {"popup_show", 1, 1, FEARG_1, NULL,
+ {"popup_show", 1, 1, FEARG_1, arg1_number,
ret_void, PROP_FUNC(f_popup_show)},
{"pow", 2, 2, FEARG_1, arg2_float_or_nr,
ret_float, FLOAT_FUNC(f_pow)},
ret_void, PROP_FUNC(f_prop_clear)},
{"prop_find", 1, 2, FEARG_1, arg2_dict_string,
ret_dict_any, PROP_FUNC(f_prop_find)},
- {"prop_list", 1, 2, FEARG_1, NULL,
+ {"prop_list", 1, 2, FEARG_1, arg2_nr_dict_any,
ret_list_dict_any, PROP_FUNC(f_prop_list)},
{"prop_remove", 1, 3, FEARG_1, NULL,
ret_number, PROP_FUNC(f_prop_remove)},
ret_void, PROP_FUNC(f_prop_type_delete)},
{"prop_type_get", 1, 2, FEARG_1, arg2_string_dict,
ret_dict_any, PROP_FUNC(f_prop_type_get)},
- {"prop_type_list", 0, 1, FEARG_1, NULL,
+ {"prop_type_list", 0, 1, FEARG_1, arg1_dict_any,
ret_list_string, PROP_FUNC(f_prop_type_list)},
{"pum_getpos", 0, 0, 0, NULL,
ret_dict_number, f_pum_getpos},
{"pumvisible", 0, 0, 0, NULL,
ret_number_bool, f_pumvisible},
- {"py3eval", 1, 1, FEARG_1, NULL,
+ {"py3eval", 1, 1, FEARG_1, arg1_string,
ret_any,
#ifdef FEAT_PYTHON3
f_py3eval
NULL
#endif
},
- {"pyeval", 1, 1, FEARG_1, NULL,
+ {"pyeval", 1, 1, FEARG_1, arg1_string,
ret_any,
#ifdef FEAT_PYTHON
f_pyeval
NULL
#endif
},
- {"pyxeval", 1, 1, FEARG_1, NULL,
+ {"pyxeval", 1, 1, FEARG_1, arg1_string,
ret_any,
#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3)
f_pyxeval
ret_string, f_remote_foreground},
{"remote_peek", 1, 2, FEARG_1, arg2_string,
ret_number, f_remote_peek},
- {"remote_read", 1, 2, FEARG_1, NULL,
+ {"remote_read", 1, 2, FEARG_1, arg2_string_nr,
ret_string, f_remote_read},
{"remote_send", 2, 3, FEARG_1, NULL,
ret_string, f_remote_send},
ret_first_arg, f_reverse},
{"round", 1, 1, FEARG_1, arg1_float_or_nr,
ret_float, FLOAT_FUNC(f_round)},
- {"rubyeval", 1, 1, FEARG_1, NULL,
+ {"rubyeval", 1, 1, FEARG_1, arg1_string,
ret_any,
#ifdef FEAT_RUBY
f_rubyeval
ret_string, f_screenstring},
{"search", 1, 5, FEARG_1, NULL,
ret_number, f_search},
- {"searchcount", 0, 1, FEARG_1, arg1_dict,
+ {"searchcount", 0, 1, FEARG_1, arg1_dict_any,
ret_dict_any, f_searchcount},
{"searchdecl", 1, 3, FEARG_1, NULL,
ret_number_bool, f_searchdecl},
ret_number_bool, f_server2client},
{"serverlist", 0, 0, 0, NULL,
ret_string, f_serverlist},
- {"setbufline", 3, 3, FEARG_3, NULL,
+ {"setbufline", 3, 3, FEARG_3, arg3_setbufline,
ret_number_bool, f_setbufline},
{"setbufvar", 3, 3, FEARG_3, NULL,
ret_void, f_setbufvar},
- {"setcellwidths", 1, 1, FEARG_1, NULL,
+ {"setcellwidths", 1, 1, FEARG_1, arg1_list_any,
ret_void, f_setcellwidths},
{"setcharpos", 2, 2, FEARG_2, NULL,
ret_number_bool, f_setcharpos},
- {"setcharsearch", 1, 1, FEARG_1, arg1_dict,
+ {"setcharsearch", 1, 1, FEARG_1, arg1_dict_any,
ret_void, f_setcharsearch},
{"setcmdpos", 1, 1, FEARG_1, arg1_number,
ret_number_bool, f_setcmdpos},
ret_void, f_setenv},
{"setfperm", 2, 2, FEARG_1, arg2_string,
ret_number_bool, f_setfperm},
- {"setline", 2, 2, FEARG_2, NULL,
+ {"setline", 2, 2, FEARG_2, arg2_setline,
ret_number_bool, f_setline},
{"setloclist", 2, 4, FEARG_2, NULL,
ret_number_bool, f_setloclist},
ret_number, f_shiftwidth},
{"sign_define", 1, 2, FEARG_1, arg2_string_or_list_dict,
ret_any, SIGN_FUNC(f_sign_define)},
- {"sign_getdefined", 0, 1, FEARG_1, NULL,
+ {"sign_getdefined", 0, 1, FEARG_1, arg1_string,
ret_list_dict_any, SIGN_FUNC(f_sign_getdefined)},
{"sign_getplaced", 0, 2, FEARG_1, NULL,
ret_list_dict_any, SIGN_FUNC(f_sign_getplaced)},
ret_number, SIGN_FUNC(f_sign_jump)},
{"sign_place", 4, 5, FEARG_1, NULL,
ret_number, SIGN_FUNC(f_sign_place)},
- {"sign_placelist", 1, 1, FEARG_1, NULL,
+ {"sign_placelist", 1, 1, FEARG_1, arg1_list_any,
ret_list_number, SIGN_FUNC(f_sign_placelist)},
{"sign_undefine", 0, 1, FEARG_1, arg1_string_or_list_string,
ret_number_bool, SIGN_FUNC(f_sign_undefine)},
{"sign_unplace", 1, 2, FEARG_1, arg2_string_dict,
ret_number_bool, SIGN_FUNC(f_sign_unplace)},
- {"sign_unplacelist", 1, 2, FEARG_1, NULL,
+ {"sign_unplacelist", 1, 2, FEARG_1, arg1_list_any,
ret_list_number, SIGN_FUNC(f_sign_unplacelist)},
{"simplify", 1, 1, FEARG_1, arg1_string,
ret_string, f_simplify},
ret_list_number, f_str2list},
{"str2nr", 1, 3, FEARG_1, arg3_string_nr_bool,
ret_number, f_str2nr},
- {"strcharlen", 1, 1, FEARG_1, NULL,
+ {"strcharlen", 1, 1, FEARG_1, arg1_string_or_nr,
ret_number, f_strcharlen},
{"strcharpart", 2, 4, FEARG_1, NULL,
ret_string, f_strcharpart},
{"strchars", 1, 2, FEARG_1, NULL,
ret_number, f_strchars},
- {"strdisplaywidth", 1, 2, FEARG_1, NULL,
+ {"strdisplaywidth", 1, 2, FEARG_1, arg2_string_nr,
ret_number, f_strdisplaywidth},
- {"strftime", 1, 2, FEARG_1, NULL,
+ {"strftime", 1, 2, FEARG_1, arg2_string_nr,
ret_string,
#ifdef HAVE_STRFTIME
f_strftime
NULL
#endif
},
- {"strgetchar", 2, 2, FEARG_1, NULL,
+ {"strgetchar", 2, 2, FEARG_1, arg2_string_nr,
ret_number, f_strgetchar},
{"stridx", 2, 3, FEARG_1, arg3_string_string_nr,
ret_number, f_stridx},
ret_list_number, f_tabpagebuflist},
{"tabpagenr", 0, 1, 0, arg1_string,
ret_number, f_tabpagenr},
- {"tabpagewinnr", 1, 2, FEARG_1, NULL,
+ {"tabpagewinnr", 1, 2, FEARG_1, arg2_nr_string,
ret_number, f_tabpagewinnr},
{"tagfiles", 0, 0, 0, NULL,
ret_list_string, f_tagfiles},
NULL
#endif
},
- {"term_getattr", 2, 2, FEARG_1, NULL,
+ {"term_getattr", 2, 2, FEARG_1, arg2_nr_string,
ret_number, TERM_FUNC(f_term_getattr)},
{"term_getcursor", 1, 1, FEARG_1, arg1_string_or_nr,
ret_list_any, TERM_FUNC(f_term_getcursor)},
ret_string, f_test_null_string},
{"test_option_not_set", 1, 1, FEARG_1, arg1_string,
ret_void, f_test_option_not_set},
- {"test_override", 2, 2, FEARG_2, NULL,
+ {"test_override", 2, 2, FEARG_2, arg2_string_nr,
ret_void, f_test_override},
{"test_refcount", 1, 1, FEARG_1, NULL,
ret_number, f_test_refcount},
ret_dict_any, f_undotree},
{"uniq", 1, 3, FEARG_1, NULL,
ret_list_any, f_uniq},
- {"values", 1, 1, FEARG_1, arg1_dict,
+ {"values", 1, 1, FEARG_1, arg1_dict_any,
ret_list_any, f_values},
{"virtcol", 1, 1, FEARG_1, arg1_string_or_list_any,
ret_number, f_virtcol},
- {"visualmode", 0, 1, 0, NULL,
+ {"visualmode", 0, 1, 0, arg1_bool,
ret_string, f_visualmode},
{"wildmenumode", 0, 0, 0, NULL,
ret_number, f_wildmenumode},
ret_number, f_winnr},
{"winrestcmd", 0, 0, 0, NULL,
ret_string, f_winrestcmd},
- {"winrestview", 1, 1, FEARG_1, arg1_dict,
+ {"winrestview", 1, 1, FEARG_1, arg1_dict_any,
ret_void, f_winrestview},
{"winsaveview", 0, 0, 0, NULL,
ret_dict_number, f_winsaveview},
static void
f_echoraw(typval_T *argvars, typval_T *rettv UNUSED)
{
- char_u *str = tv_get_string_chk(&argvars[0]);
+ char_u *str;
+
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+ str = tv_get_string_chk(&argvars[0]);
if (str != NULL && *str != NUL)
{
out_str(str);
dictitem_T *di;
rettv->vval.v_number = -1;
+
+ if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+ return;
+
end = get_lval(tv_get_string(&argvars[0]), NULL, &lv, FALSE, FALSE,
GLV_NO_AUTOLOAD | GLV_READ_ONLY, FNE_CHECK_START);
if (end != NULL && lv.ll_name != NULL)
win_T *save_curwin;
tabpage_T *save_curtab;
+ if (in_vim9script()
+ && (check_for_string_arg(argvars, 0) == FAIL
+ || (argvars[1].v_type != VAR_UNKNOWN
+ && check_for_number_arg(argvars, 1) == FAIL)))
+ return;
+
if (argvars[1].v_type != VAR_UNKNOWN)
{
// use window specified in the second argument
endif
enddef
+def Test_add_blob()
+ var b1: blob = 0z12
+ add(b1, 0x34)
+ assert_equal(0z1234, b1)
+
+ var b2: blob # defaults to empty blob
+ add(b2, 0x67)
+ assert_equal(0z67, b2)
+
+ var lines =<< trim END
+ var b: blob
+ add(b, "x")
+ END
+ CheckDefFailure(lines, 'E1012:', 2)
+
+ lines =<< trim END
+ add(test_null_blob(), 123)
+ END
+ CheckDefExecAndScriptFailure(lines, 'E1131:', 1)
+
+ lines =<< trim END
+ var b: blob = test_null_blob()
+ add(b, 123)
+ END
+ CheckDefExecFailure(lines, 'E1131:', 2)
+
+ # Getting variable with NULL blob allocates a new blob at script level
+ lines =<< trim END
+ vim9script
+ var b: blob = test_null_blob()
+ add(b, 123)
+ END
+ CheckScriptSuccess(lines)
+enddef
+
def Test_add_list()
var l: list<number> # defaults to empty list
add(l, 9)
CheckScriptFailure(lines, 'E1012: Type mismatch; expected string but got number', 3)
enddef
-def Test_add_blob()
- var b1: blob = 0z12
- add(b1, 0x34)
- assert_equal(0z1234, b1)
-
- var b2: blob # defaults to empty blob
- add(b2, 0x67)
- assert_equal(0z67, b2)
-
- var lines =<< trim END
- var b: blob
- add(b, "x")
- END
- CheckDefFailure(lines, 'E1012:', 2)
-
- lines =<< trim END
- add(test_null_blob(), 123)
- END
- CheckDefExecAndScriptFailure(lines, 'E1131:', 1)
-
- lines =<< trim END
- var b: blob = test_null_blob()
- add(b, 123)
- END
- CheckDefExecFailure(lines, 'E1131:', 2)
-
- # Getting variable with NULL blob allocates a new blob at script level
- lines =<< trim END
- vim9script
- var b: blob = test_null_blob()
- add(b, 123)
- END
- CheckScriptSuccess(lines)
-enddef
-
def Test_and()
CheckDefAndScriptFailure2(['and("x", 0x2)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
CheckDefAndScriptFailure2(['and(0x1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
append(0, 'zero')
assert_equal('zero', getline(1))
+ append(0, {a: 10})
+ assert_equal("{'a': 10}", getline(1))
+ append(0, function('min'))
+ assert_equal("function('min')", getline(1))
+ CheckDefAndScriptFailure2(['append([1], "x")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E745: Using a List as a Number')
+ bwipe!
+enddef
+
+def Test_appendbufline()
+ new
+ var bnum: number = bufnr()
+ :wincmd w
+ appendbufline(bnum, 0, range(3))
+ var res1: number = appendbufline(bnum, 1, 'one')
+ assert_equal(0, res1)
+ var res2: bool = appendbufline(bnum, 3, 'two')
+ assert_equal(false, res2)
+ assert_equal(['0', 'one', '1', 'two', '2', ''], getbufline(bnum, 1, '$'))
+ appendbufline(bnum, 0, 'zero')
+ assert_equal(['zero'], getbufline(bnum, 1))
+ CheckDefFailure(['appendbufline([1], 1, "x")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>')
+ CheckDefFailure(['appendbufline(1, [1], "x")'], 'E1013: Argument 2: type mismatch, expected string but got list<number>')
+ CheckDefFailure(['appendbufline(1, 1, {"a": 10})'], 'E1013: Argument 3: type mismatch, expected string but got dict<number>')
+ bnum->bufwinid()->win_gotoid()
bwipe!
enddef
CheckDefFailure(['argv("x", "y")'], 'E1013: Argument 1: type mismatch, expected number but got string')
enddef
+def Test_assert_beeps()
+ CheckDefAndScriptFailure2(['assert_beeps(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+enddef
+
def Test_assert_equalfile()
CheckDefFailure(['assert_equalfile(1, "f2")'], 'E1013: Argument 1: type mismatch, expected string but got number')
CheckDefFailure(['assert_equalfile("f1", true)'], 'E1013: Argument 2: type mismatch, expected string but got bool')
CheckDefFailure(['assert_match("a", "b", null)'], 'E1013: Argument 3: type mismatch, expected string but got special')
enddef
+def Test_assert_nobeep()
+ CheckDefAndScriptFailure2(['assert_nobeep(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+enddef
+
def Test_assert_notmatch()
CheckDefFailure(['assert_notmatch({}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>')
CheckDefFailure(['assert_notmatch("a", 1)'], 'E1013: Argument 2: type mismatch, expected string but got number')
assert_equal(-1, byte2line(0))
enddef
+def Test_byteidx()
+ CheckDefAndScriptFailure2(['byteidx(1, 2)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['byteidx("a", "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+enddef
+
+def Test_byteidxcomp()
+ CheckDefAndScriptFailure2(['byteidxcomp(1, 2)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['byteidxcomp("a", "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+enddef
+
def Test_call_call()
var l = [3, 2, 1]
call('reverse', [l])
CheckDefFailure(['ch_close_in(true)'], 'E1013: Argument 1: type mismatch, expected channel but got bool')
enddef
+def Test_ch_getjob()
+ CheckDefAndScriptFailure2(['ch_getjob(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument:')
+ CheckDefAndScriptFailure2(['ch_getjob({"a": 10})'], 'E1013: Argument 1: type mismatch, expected channel but got dict<number>', 'E731: Using a Dictionary as a String')
+ assert_equal(0, ch_getjob(test_null_channel()))
+enddef
+
def Test_ch_info()
if !has('channel')
CheckFeature channel
CheckDefAndScriptFailure2(['ch_open("a", [1])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 2')
enddef
+def Test_ch_read()
+ if !has('channel')
+ CheckFeature channel
+ endif
+ CheckDefAndScriptFailure2(['ch_read(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument')
+ CheckDefAndScriptFailure2(['ch_read(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E715: Dictionary required')
+enddef
+
+def Test_ch_readblob()
+ if !has('channel')
+ CheckFeature channel
+ endif
+ CheckDefAndScriptFailure2(['ch_readblob(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument')
+ CheckDefAndScriptFailure2(['ch_readblob(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E715: Dictionary required')
+enddef
+
+def Test_ch_readraw()
+ if !has('channel')
+ CheckFeature channel
+ endif
+ CheckDefAndScriptFailure2(['ch_readraw(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument')
+ CheckDefAndScriptFailure2(['ch_readraw(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E715: Dictionary required')
+enddef
+
+def Test_ch_setoptions()
+ if !has('channel')
+ CheckFeature channel
+ endif
+ CheckDefAndScriptFailure2(['ch_setoptions(1, {})'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument')
+ CheckDefFailure(['ch_setoptions(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>')
+enddef
+
+def Test_ch_status()
+ if !has('channel')
+ CheckFeature channel
+ endif
+ CheckDefAndScriptFailure2(['ch_status(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument')
+ CheckDefAndScriptFailure2(['ch_status(test_null_channel(), [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E715: Dictionary required')
+enddef
+
def Test_char2nr()
char2nr('あ', true)->assert_equal(12354)
bw!
enddef
+def Test_complete_info()
+ CheckDefFailure(['complete_info("")'], 'E1013: Argument 1: type mismatch, expected list<string> but got string')
+ CheckDefFailure(['complete_info({})'], 'E1013: Argument 1: type mismatch, expected list<string> but got dict<unknown>')
+ assert_equal({'pum_visible': 0, 'mode': '', 'selected': -1, 'items': []}, complete_info())
+ assert_equal({'mode': '', 'items': []}, complete_info(['mode', 'items']))
+enddef
+
def Test_confirm()
if !has('dialog_con') && !has('dialog_gui')
CheckFeature dialog_con
assert_fails('confirm("yes", "maybe", 2, true)', 'E1174:')
enddef
-def Test_complete_info()
- CheckDefFailure(['complete_info("")'], 'E1013: Argument 1: type mismatch, expected list<string> but got string')
- CheckDefFailure(['complete_info({})'], 'E1013: Argument 1: type mismatch, expected list<string> but got dict<unknown>')
- assert_equal({'pum_visible': 0, 'mode': '', 'selected': -1, 'items': []}, complete_info())
- assert_equal({'mode': '', 'items': []}, complete_info(['mode', 'items']))
-enddef
-
def Test_copy_return_type()
var l = copy([1, 2, 3])
var res = 0
assert_equal(0, diff_filler('.'))
enddef
+def Test_echoraw()
+ CheckDefAndScriptFailure2(['echoraw(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['echoraw(["x"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1')
+enddef
+
def Test_escape()
CheckDefFailure(['escape("a", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number')
CheckDefFailure(['escape(10, " ")'], 'E1013: Argument 1: type mismatch, expected string but got number')
CheckDefExecFailure(['extend([1], ["b", 1])'], 'E1013: Argument 2: type mismatch, expected list<number> but got list<any>')
enddef
-def Test_extendnew()
- assert_equal([1, 2, 'a'], extendnew([1, 2], ['a']))
- assert_equal({one: 1, two: 'a'}, extendnew({one: 1}, {two: 'a'}))
-
- CheckDefFailure(['extendnew({a: 1}, 42)'], 'E1013: Argument 2: type mismatch, expected dict<number> but got number')
- CheckDefFailure(['extendnew({a: 1}, [42])'], 'E1013: Argument 2: type mismatch, expected dict<number> but got list<number>')
- CheckDefFailure(['extendnew([1, 2], "x")'], 'E1013: Argument 2: type mismatch, expected list<number> but got string')
- CheckDefFailure(['extendnew([1, 2], {x: 1})'], 'E1013: Argument 2: type mismatch, expected list<number> but got dict<number>')
-enddef
-
-def Test_extend_return_type()
- var l = extend([1, 2], [3])
- var res = 0
- for n in l
- res += n
- endfor
- res->assert_equal(6)
-enddef
-
func g:ExtendDict(d)
call extend(a:d, #{xx: 'x'})
endfunc
CheckScriptFailure(['vim9script'] + lines, 'E1012:', 1)
enddef
+def Test_extend_return_type()
+ var l = extend([1, 2], [3])
+ var res = 0
+ for n in l
+ res += n
+ endfor
+ res->assert_equal(6)
+enddef
+
def Test_extend_with_error_function()
var lines =<< trim END
vim9script
CheckScriptFailure(lines, 'E1001: Variable not found: m')
enddef
+def Test_extendnew()
+ assert_equal([1, 2, 'a'], extendnew([1, 2], ['a']))
+ assert_equal({one: 1, two: 'a'}, extendnew({one: 1}, {two: 'a'}))
+
+ CheckDefFailure(['extendnew({a: 1}, 42)'], 'E1013: Argument 2: type mismatch, expected dict<number> but got number')
+ CheckDefFailure(['extendnew({a: 1}, [42])'], 'E1013: Argument 2: type mismatch, expected dict<number> but got list<number>')
+ CheckDefFailure(['extendnew([1, 2], "x")'], 'E1013: Argument 2: type mismatch, expected list<number> but got string')
+ CheckDefFailure(['extendnew([1, 2], {x: 1})'], 'E1013: Argument 2: type mismatch, expected list<number> but got dict<number>')
+enddef
+
def Test_feedkeys()
CheckDefFailure(['feedkeys(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
CheckDefFailure(['feedkeys("x", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number')
unlet g:TestVar
enddef
-def Test_indent()
- CheckDefAndScriptFailure2(['indent([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E745: Using a List as a Number')
- CheckDefAndScriptFailure2(['indent(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1138: Using a Bool as a Number')
- assert_equal(0, indent(1))
-enddef
-
-def Test_input()
- CheckDefFailure(['input(5)'], 'E1013: Argument 1: type mismatch, expected string but got number')
- CheckDefAndScriptFailure2(['input(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
- CheckDefFailure(['input("p", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number')
- CheckDefAndScriptFailure2(['input("p", "q", 20)'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E180: Invalid complete value')
-enddef
-
-def Test_inputdialog()
- CheckDefFailure(['inputdialog(5)'], 'E1013: Argument 1: type mismatch, expected string but got number')
- CheckDefAndScriptFailure2(['inputdialog(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
- CheckDefFailure(['inputdialog("p", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number')
- CheckDefFailure(['inputdialog("p", "q", 20)'], 'E1013: Argument 3: type mismatch, expected string but got number')
-enddef
-
-def Test_job_info_return_type()
- if has('job')
- job_start(&shell)
- var jobs = job_info()
- assert_equal('list<job>', typename(jobs))
- assert_equal('dict<any>', typename(job_info(jobs[0])))
- job_stop(jobs[0])
- endif
-enddef
-
def Test_filereadable()
assert_false(filereadable(""))
assert_false(filereadable(test_null_string()))
def Test_garbagecollect()
garbagecollect(true)
+ CheckDefAndScriptFailure2(['garbagecollect("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string', 'E1135: Using a String as a Bool')
+ CheckDefAndScriptFailure2(['garbagecollect(20)'], 'E1013: Argument 1: type mismatch, expected bool but got number', 'E1023: Using a Number as a Bool')
enddef
def Test_getbufinfo()
while getchar(0)
endwhile
getchar(true)->assert_equal(0)
+ getchar(1)->assert_equal(0)
+ CheckDefAndScriptFailure2(['getchar(2)'], 'E1013: Argument 1: type mismatch, expected bool but got number', 'E1023: Using a Number as a Bool')
+ CheckDefAndScriptFailure2(['getchar("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string', 'E1135: Using a String as a Bool')
+enddef
+
+def Test_getcharpos()
+ CheckDefAndScriptFailure2(['getcharpos(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['getcharpos(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+enddef
+
+def Test_getcharstr()
+ CheckDefAndScriptFailure2(['getcharstr(2)'], 'E1013: Argument 1: type mismatch, expected bool but got number', 'E1023: Using a Number as a Bool')
+ CheckDefAndScriptFailure2(['getcharstr("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string', 'E1135: Using a String as a Bool')
enddef
def Test_getenv()
CheckDefFailure(['getcwd(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string')
enddef
-def Test_getloclist_return_type()
- var l = getloclist(1)
- l->assert_equal([])
-
- var d = getloclist(1, {items: 0})
- d->assert_equal({items: []})
-enddef
-
def Test_getfontname()
CheckDefFailure(['getfontname(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
enddef
CheckDefExecAndScriptFailure(lines, 'E1209:')
enddef
+def Test_getloclist()
+ CheckDefAndScriptFailure2(['getloclist("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['getloclist(1, [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E715: Dictionary required')
+enddef
+
+def Test_getloclist_return_type()
+ var l = getloclist(1)
+ l->assert_equal([])
+
+ var d = getloclist(1, {items: 0})
+ d->assert_equal({items: []})
+enddef
+
def Test_getmarklist()
CheckDefFailure(['getmarklist([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>')
assert_equal([], getmarklist(10000))
assert_equal('skyblue', histget('/', -1))
enddef
+def Test_histget()
+ CheckDefAndScriptFailure2(['histget(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['histget("a", "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+enddef
+
def Test_histnr()
CheckDefFailure(['histnr(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
assert_equal(-1, histnr('abc'))
assert_equal('abc', iconv('abc', 'fromenc', 'toenc'))
enddef
+def Test_indent()
+ CheckDefAndScriptFailure2(['indent([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E745: Using a List as a Number')
+ CheckDefAndScriptFailure2(['indent(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1138: Using a Bool as a Number')
+ assert_equal(0, indent(1))
+enddef
+
def Test_index()
index(['a', 'b', 'a', 'B'], 'b', 2, true)->assert_equal(3)
enddef
+def Test_input()
+ CheckDefFailure(['input(5)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['input(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
+ CheckDefFailure(['input("p", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['input("p", "q", 20)'], 'E1013: Argument 3: type mismatch, expected string but got number', 'E180: Invalid complete value')
+enddef
+
+def Test_inputdialog()
+ CheckDefFailure(['inputdialog(5)'], 'E1013: Argument 1: type mismatch, expected string but got number')
+ CheckDefAndScriptFailure2(['inputdialog(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
+ CheckDefFailure(['inputdialog("p", 10)'], 'E1013: Argument 2: type mismatch, expected string but got number')
+ CheckDefFailure(['inputdialog("p", "q", 20)'], 'E1013: Argument 3: type mismatch, expected string but got number')
+enddef
+
def Test_inputlist()
CheckDefFailure(['inputlist(10)'], 'E1013: Argument 1: type mismatch, expected list<string> but got number')
CheckDefFailure(['inputlist("abc")'], 'E1013: Argument 1: type mismatch, expected list<string> but got string')
assert_false(isdirectory('NonExistingDir'))
enddef
+def Test_islocked()
+ CheckDefAndScriptFailure2(['islocked(true)'], 'E1013: Argument 1: type mismatch, expected string but got bool', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['var n1: number = 10', 'islocked(n1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ g:v1 = 10
+ assert_false(islocked('g:v1'))
+ lockvar g:v1
+ assert_true(islocked('g:v1'))
+ unlet g:v1
+enddef
+
def Test_items()
CheckDefFailure(['[]->items()'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>')
assert_equal([['a', 10], ['b', 20]], {'a': 10, 'b': 20}->items())
assert_equal([], {}->items())
enddef
+def Test_job_getchannel()
+ CheckDefAndScriptFailure2(['job_getchannel("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E475: Invalid argument')
+ assert_fails('job_getchannel(test_null_job())', 'E916: not a valid job')
+enddef
+
+def Test_job_info()
+ CheckDefAndScriptFailure2(['job_info("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E475: Invalid argument')
+ assert_fails('job_info(test_null_job())', 'E916: not a valid job')
+enddef
+
+def Test_job_info_return_type()
+ if has('job')
+ job_start(&shell)
+ var jobs = job_info()
+ assert_equal('list<job>', typename(jobs))
+ assert_equal('dict<any>', typename(job_info(jobs[0])))
+ job_stop(jobs[0])
+ endif
+enddef
+
+def Test_job_status()
+ CheckDefAndScriptFailure2(['job_status("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E475: Invalid argument')
+ assert_equal('fail', job_status(test_null_job()))
+enddef
+
def Test_js_decode()
CheckDefFailure(['js_decode(10)'], 'E1013: Argument 1: type mismatch, expected string but got number')
assert_equal([1, 2], js_decode('[1,2]'))
def Test_line()
assert_fails('line(true)', 'E1174:')
+ CheckDefAndScriptFailure2(['line(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['line(".", "a")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
enddef
def Test_line2byte()
? [1, max([2, 3])]
: [4, 5]
assert_equal([4, 5], l2)
+ CheckDefAndScriptFailure2(['max(5)'], 'E1013: Argument 1: type mismatch, expected list<any> but got number', 'E712: Argument of max() must be a List or Dictionary')
enddef
def Test_menu_info()
? [1, min([2, 3])]
: [4, 5]
assert_equal([4, 5], l2)
+ CheckDefAndScriptFailure2(['min(5)'], 'E1013: Argument 1: type mismatch, expected list<any> but got number', 'E712: Argument of min() must be a List or Dictionary')
enddef
def Test_mkdir()
delete('a', 'rf')
enddef
+def Test_mode()
+ CheckDefFailure(['mode("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string')
+ CheckDefFailure(['mode(2)'], 'E1013: Argument 1: type mismatch, expected bool but got number')
+enddef
+
+def Test_mzeval()
+ if !has('mzscheme')
+ CheckFeature mzscheme
+ endif
+ CheckDefAndScriptFailure2(['mzscheme(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
+enddef
+
def Test_nextnonblank()
CheckDefFailure(['nextnonblank(null)'], 'E1013: Argument 1: type mismatch, expected string but got special')
assert_equal(0, nextnonblank(1))
CheckDefFailure(['or(0x1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string')
enddef
+def Test_pathshorten()
+ CheckDefAndScriptFailure2(['pathshorten(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['pathshorten("a", "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+enddef
+
+def Test_perleval()
+ if !has('perl')
+ CheckFeature perl
+ endif
+ CheckDefAndScriptFailure2(['perleval(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
+enddef
+
def Test_popup_atcursor()
CheckDefAndScriptFailure2(['popup_atcursor({"a": 10}, {})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E450: buffer number, text or a list required')
CheckDefAndScriptFailure2(['popup_atcursor("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
CheckDefAndScriptFailure2(['popup_beval("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
enddef
+def Test_popup_clear()
+ CheckDefAndScriptFailure2(['popup_clear(["a"])'], 'E1013: Argument 1: type mismatch, expected bool but got list<string>', 'E745: Using a List as a Number')
+ CheckDefAndScriptFailure2(['popup_clear(2)'], 'E1013: Argument 1: type mismatch, expected bool but got number', 'E1023: Using a Number as a Bool')
+enddef
+
def Test_popup_create()
# Pass variable of type 'any' to popup_create()
var what: any = 'Hello'
CheckDefAndScriptFailure2(['popup_dialog("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
enddef
+def Test_popup_filter_menu()
+ CheckDefAndScriptFailure2(['popup_filter_menu("x", "")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['popup_filter_menu(1, 1)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
+enddef
+
+def Test_popup_filter_yesno()
+ CheckDefAndScriptFailure2(['popup_filter_yesno("x", "")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['popup_filter_yesno(1, 1)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
+enddef
+
+def Test_popup_getoptions()
+ CheckDefAndScriptFailure2(['popup_getoptions("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['popup_getoptions(true)'], 'E1013: Argument 1: type mismatch, expected number but got bool', 'E1138: Using a Bool as a Number')
+enddef
+
+def Test_popup_getpos()
+ CheckDefAndScriptFailure2(['popup_getpos("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['popup_getpos(true)'], 'E1013: Argument 1: type mismatch, expected number but got bool', 'E1138: Using a Bool as a Number')
+enddef
+
+def Test_popup_hide()
+ CheckDefAndScriptFailure2(['popup_hide("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['popup_hide(true)'], 'E1013: Argument 1: type mismatch, expected number but got bool', 'E1138: Using a Bool as a Number')
+enddef
+
def Test_popup_locate()
CheckDefAndScriptFailure2(['popup_locate("a", 20)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
CheckDefAndScriptFailure2(['popup_locate(10, "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
CheckDefAndScriptFailure2(['popup_menu("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
enddef
+def Test_popup_move()
+ CheckDefAndScriptFailure2(['popup_move("x", {})'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['popup_move(1, [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2')
+enddef
+
def Test_popup_notification()
CheckDefAndScriptFailure2(['popup_notification({"a": 10}, {})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E450: buffer number, text or a list required')
CheckDefAndScriptFailure2(['popup_notification("a", [1, 2])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
enddef
+def Test_popup_setoptions()
+ CheckDefAndScriptFailure2(['popup_setoptions("x", {})'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['popup_setoptions(1, [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2')
+enddef
+
+def Test_popup_show()
+ CheckDefAndScriptFailure2(['popup_show("a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+ CheckDefAndScriptFailure2(['popup_show(true)'], 'E1013: Argument 1: type mismatch, expected number but got bool', 'E1138: Using a Bool as a Number')
+enddef
+
def Test_prevnonblank()
CheckDefFailure(['prevnonblank(null)'], 'E1013: Argument 1: type mismatch, expected string but got special')
assert_equal(0, prevnonblank(1))
CheckDefAndScriptFailure2(['prop_find({"a": 10}, ["a"])'], 'E1013: Argument 2: type mismatch, expected string but got list<string>', 'E730: Using a List as a String')
enddef
+def Test_prop_list()
+ CheckDefAndScriptFailure2(['prop_list("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['prop_list(1, [])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<unknown>', 'E1206: Dictionary required for argument 2')
+enddef
+
def Test_prop_type_add()
CheckDefAndScriptFailure2(['prop_type_add({"a": 10}, "b")'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E731: Using a Dictionary as a String')
CheckDefAndScriptFailure2(['prop_type_add("a", "b")'], 'E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E715: Dictionary required')
CheckDefAndScriptFailure2(['prop_type_get("a", "b")'], 'E1013: Argument 2: type mismatch, expected dict<any> but got string', 'E715: Dictionary required')
enddef
+def Test_prop_type_list()
+ CheckDefAndScriptFailure2(['prop_type_list(["a"])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<string>', 'E715: Dictionary required')
+ CheckDefAndScriptFailure2(['prop_type_list(2)'], 'E1013: Argument 1: type mismatch, expected dict<any> but got number', 'E715: Dictionary required')
+enddef
+
+def Test_py3eval()
+ if !has('python3')
+ CheckFeature python3
+ endif
+ CheckDefAndScriptFailure2(['py3eval([2])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
+enddef
+
+def Test_pyeval()
+ if !has('python')
+ CheckFeature python
+ endif
+ CheckDefAndScriptFailure2(['pyeval([2])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
+enddef
+
+def Test_pyxeval()
+ if !has('python') && !has('python3')
+ CheckFeature python
+ endif
+ CheckDefAndScriptFailure2(['pyxeval([2])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
+enddef
+
def Test_rand()
CheckDefFailure(['rand(10)'], 'E1013: Argument 1: type mismatch, expected list<number> but got number')
CheckDefFailure(['rand(["a"])'], 'E1013: Argument 1: type mismatch, expected list<number> but got list<string>')
CheckDefAndScriptFailure2(['remote_peek("a5b6c7", [1])'], 'E1013: Argument 2: type mismatch, expected string but got list<number>', 'E573: Invalid server id used')
enddef
+def Test_remote_read()
+ CheckFeature clientserver
+ CheckEnv DISPLAY
+ CheckDefAndScriptFailure2(['remote_read(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['remote_read("a", "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+enddef
+
def Test_remote_startserver()
CheckFeature clientserver
CheckEnv DISPLAY
res->assert_equal(6)
enddef
+def Test_rubyeval()
+ if !has('ruby')
+ CheckFeature ruby
+ endif
+ CheckDefAndScriptFailure2(['rubyeval([2])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
+enddef
+
def Test_screenattr()
CheckDefFailure(['screenattr("x", 1)'], 'E1013: Argument 1: type mismatch, expected number but got string')
CheckDefFailure(['screenattr(1, "x")'], 'E1013: Argument 2: type mismatch, expected number but got string')
maxcount: 99,
incomplete: 0})
bwipe!
+ CheckDefAndScriptFailure2(['searchcount([1])'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary required')
enddef
def Test_searchpair()
CheckDefFailure(['setfperm("a", 0z10)'], 'E1013: Argument 2: type mismatch, expected string but got blob')
enddef
+def Test_setbufline()
+ new
+ var bnum = bufnr('%')
+ :wincmd w
+ setbufline(bnum, 1, range(1, 3))
+ setbufline(bnum, 4, 'one')
+ setbufline(bnum, 5, 10)
+ setbufline(bnum, 6, ['two', 11])
+ assert_equal(['1', '2', '3', 'one', '10', 'two', '11'], getbufline(bnum, 1, '$'))
+ CheckDefFailure(['setbufline([1], 1, "x")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>')
+ CheckDefFailure(['setbufline(1, [1], "x")'], 'E1013: Argument 2: type mismatch, expected string but got list<number>')
+ CheckDefFailure(['setbufline(1, 1, {"a": 10})'], 'E1013: Argument 3: type mismatch, expected string but got dict<number>')
+ bnum->bufwinid()->win_gotoid()
+ bw!
+enddef
+
+def Test_setcellwidths()
+ CheckDefAndScriptFailure2(['setcellwidths(1)'], 'E1013: Argument 1: type mismatch, expected list<any> but got number', 'E714: List required')
+ CheckDefAndScriptFailure2(['setcellwidths({"a": 10})'], 'E1013: Argument 1: type mismatch, expected list<any> but got dict<number>', 'E714: List required')
+enddef
+
def Test_setline()
new
setline(1, range(1, 4))
assert_equal(['a', 'b', 'c', 'd'], getline(1, '$'))
setline(1, 'one')
assert_equal(['one', 'b', 'c', 'd'], getline(1, '$'))
+ setline(1, 10)
+ assert_equal(['10', 'b', 'c', 'd'], getline(1, '$'))
+ CheckDefAndScriptFailure2(['setline([1], "x")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E745: Using a List as a Number')
bw!
enddef
CheckDefAndScriptFailure2(['sign_define("a", ["b"])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<string>', 'E715: Dictionary required')
enddef
+def Test_sign_getdefined()
+ CheckDefAndScriptFailure2(['sign_getdefined(["x"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['sign_getdefined(2)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+enddef
+
+def Test_sign_placelist()
+ CheckDefAndScriptFailure2(['sign_placelist("x")'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E714: List required')
+ CheckDefAndScriptFailure2(['sign_placelist({"a": 10})'], 'E1013: Argument 1: type mismatch, expected list<any> but got dict<number>', 'E714: List required')
+enddef
+
def Test_sign_undefine()
CheckDefAndScriptFailure2(['sign_undefine({})'], 'E1013: Argument 1: type mismatch, expected string but got dict<unknown>', 'E731: Using a Dictionary as a String')
CheckDefAndScriptFailure2(['sign_undefine([1])'], 'E1013: Argument 1: type mismatch, expected list<string> but got list<number>', 'E155: Unknown sign:')
CheckDefAndScriptFailure2(['sign_unplace("a", ["b"])'], 'E1013: Argument 2: type mismatch, expected dict<any> but got list<string>', 'E715: Dictionary required')
enddef
+def Test_sign_unplacelist()
+ CheckDefAndScriptFailure2(['sign_unplacelist("x")'], 'E1013: Argument 1: type mismatch, expected list<any> but got string', 'E714: List required')
+ CheckDefAndScriptFailure2(['sign_unplacelist({"a": 10})'], 'E1013: Argument 1: type mismatch, expected list<any> but got dict<number>', 'E714: List required')
+enddef
+
def Test_simplify()
CheckDefFailure(['simplify(100)'], 'E1013: Argument 1: type mismatch, expected string but got number')
call assert_equal('NonExistingFile', simplify('NonExistingFile'))
CheckScriptFailure(['vim9script', 'echo str2nr("123", 10, "x")'], 'E1135:')
enddef
+def Test_strcharlen()
+ CheckDefAndScriptFailure2(['strcharlen([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
+ "abc"->strcharlen()->assert_equal(3)
+ strcharlen(99)->assert_equal(2)
+enddef
+
def Test_strchars()
strchars("A\u20dd", true)->assert_equal(1)
enddef
+def Test_strdisplaywidth()
+ CheckDefAndScriptFailure2(['strdisplaywidth(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['strdisplaywidth("a", "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+enddef
+
+def Test_strftime()
+ CheckDefAndScriptFailure2(['strftime(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['strftime("a", "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+enddef
+
+def Test_strgetchar()
+ CheckDefAndScriptFailure2(['strgetchar(1, 1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['strgetchar("a", "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+enddef
+
def Test_stridx()
CheckDefAndScriptFailure2(['stridx([1], "b")'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
CheckDefAndScriptFailure2(['stridx("a", {})'], 'E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E731: Using a Dictionary as a String')
assert_equal(1, tabpagenr())
enddef
+def Test_tabpagewinnr()
+ CheckDefAndScriptFailure2(['tabpagewinnr("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['tabpagewinnr(1, 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
+enddef
+
def Test_taglist()
CheckDefAndScriptFailure2(['taglist([1])'], 'E1013: Argument 1: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
CheckDefAndScriptFailure2(['taglist("a", [2])'], 'E1013: Argument 2: type mismatch, expected string but got list<number>', 'E730: Using a List as a String')
CheckDefAndScriptFailure2(['term_getansicolors(["a"])'], 'E1013: Argument 1: type mismatch, expected string but got list<string>', 'E745: Using a List as a Number')
enddef
+def Test_term_getattr()
+ CheckRunVimInTerminal
+ CheckDefAndScriptFailure2(['term_getattr("x", "a")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1')
+ CheckDefAndScriptFailure2(['term_getattr(1, 2)'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
+enddef
+
def Test_term_getcursor()
CheckRunVimInTerminal
CheckDefAndScriptFailure2(['term_getcursor({"a": 10})'], 'E1013: Argument 1: type mismatch, expected string but got dict<number>', 'E728: Using a Dictionary as a Number')
CheckDefAndScriptFailure2(['test_option_not_set([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 'E474: Invalid argument')
enddef
+def Test_test_override()
+ CheckDefAndScriptFailure2(['test_override(1, 1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
+ CheckDefAndScriptFailure2(['test_override("a", "x")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E1210: Number required for argument 2')
+enddef
+
def Test_test_setmouse()
CheckDefAndScriptFailure2(['test_setmouse("a", 10)'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E474: Invalid argument')
CheckDefAndScriptFailure2(['test_setmouse(10, "b")'], 'E1013: Argument 2: type mismatch, expected number but got string', 'E474: Invalid argument')
bw!
enddef
+def Test_visualmode()
+ CheckDefFailure(['visualmode("1")'], 'E1013: Argument 1: type mismatch, expected bool but got string')
+ CheckDefFailure(['visualmode(2)'], 'E1013: Argument 1: type mismatch, expected bool but got number')
+enddef
+
def Test_win_execute()
assert_equal("\n" .. winnr(), win_execute(win_getid(), 'echo winnr()'))
assert_equal("\n" .. winnr(), 'echo winnr()'->win_execute(win_getid()))
assert_equal(win_getid(), win_getid(1, 1))
enddef
+def Test_win_gettype()
+ CheckDefAndScriptFailure2(['win_gettype("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+enddef
+
+def Test_win_gotoid()
+ CheckDefAndScriptFailure2(['win_gotoid("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+enddef
+
+def Test_win_id2tabwin()
+ CheckDefAndScriptFailure2(['win_id2tabwin("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+enddef
+
+def Test_win_id2win()
+ CheckDefAndScriptFailure2(['win_id2win("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+enddef
+
+def Test_win_screenpos()
+ CheckDefAndScriptFailure2(['win_screenpos("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+enddef
+
def Test_win_splitmove()
split
win_splitmove(1, 2, {vertical: true, rightbelow: true})
close
enddef
+def Test_winbufnr()
+ CheckDefAndScriptFailure2(['winbufnr("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+enddef
+
+def Test_winheight()
+ CheckDefAndScriptFailure2(['winheight("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+enddef
+
+def Test_winlayout()
+ CheckDefAndScriptFailure2(['winlayout("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
+enddef
+
def Test_winnr()
CheckDefFailure(['winnr([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>')
assert_equal(1, winnr())
CheckDefAndScriptFailure(lines, 'E1012: Type mismatch; expected list<number> but got dict<number>', 1)
enddef
-def Test_win_gettype()
- CheckDefAndScriptFailure2(['win_gettype("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
-enddef
-
-def Test_win_gotoid()
- CheckDefAndScriptFailure2(['win_gotoid("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
-enddef
-
-def Test_win_id2tabwin()
- CheckDefAndScriptFailure2(['win_id2tabwin("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
-enddef
-
-def Test_win_id2win()
- CheckDefAndScriptFailure2(['win_id2win("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
-enddef
-
-def Test_win_screenpos()
- CheckDefAndScriptFailure2(['win_screenpos("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
-enddef
-
-def Test_winbufnr()
- CheckDefAndScriptFailure2(['winbufnr("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
-enddef
-
-def Test_winheight()
- CheckDefAndScriptFailure2(['winheight("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
-enddef
-
-def Test_winlayout()
- CheckDefAndScriptFailure2(['winlayout("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
-enddef
-
def Test_winwidth()
CheckDefAndScriptFailure2(['winwidth("x")'], 'E1013: Argument 1: type mismatch, expected number but got string', 'E1030: Using a String as a Number')
enddef