function({name} [, {arglist}] [, {dict}])
Funcref reference to function {name}
garbagecollect([{atexit}]) none free memory, breaking cyclic references
-garbagecollect_for_testing() none free memory right now
get({list}, {idx} [, {def}]) any get item {idx} from {list} or {def}
get({dict}, {key} [, {def}]) any get item {key} from {dict} or {def}
getbufline({expr}, {lnum} [, {end}])
tan({expr}) Float tangent of {expr}
tanh({expr}) Float hyperbolic tangent of {expr}
tempname() String name for a temporary file
+test_garbagecollect_now() none free memory right now for testing
+test_null_channel() Channel null value for testing
+test_null_dict() Dict null value for testing
+test_null_job() Job null value for testing
+test_null_list() List null value for testing
+test_null_partial() Funcref null value for testing
+test_null_string() String null value for testing
timer_start({time}, {callback} [, {options}])
Number create a timer
timer_stop({timer}) none stop a timer
collection will also be done when exiting Vim, if it wasn't
done before. This is useful when checking for memory leaks.
-garbagecollect_for_testing() *garbagecollect_for_testing()*
- Like garbagecollect(), but executed right away. This must
- only be called directly to avoid any structure to exist
- internally, and |v:testing| must have been set before calling
- any function.
+ The garbage collection is not done immediately but only when
+ it's safe to perform. This is when waiting for the user to
+ type a character. To force garbage collection immediately use
+ |test_garbagecollect_now()|.
get({list}, {idx} [, {default}]) *get()*
Get item {idx} from |List| {list}. When this item is not
located by Vim. Refer to |tags-file-format| for the format of
the tags file generated by the different ctags tools.
-tempname() *tempname()* *temp-file-name*
- The result is a String, which is the name of a file that
- doesn't exist. It can be used for a temporary file. The name
- is different for at least 26 consecutive calls. Example: >
- :let tmpfile = tempname()
- :exe "redir > " . tmpfile
-< For Unix, the file will be in a private directory |tempfile|.
- For MS-Windows forward slashes are used when the 'shellslash'
- option is set or when 'shellcmdflag' starts with '-'.
-
-
tan({expr}) *tan()*
Return the tangent of {expr}, measured in radians, as a |Float|
in the range [-inf, inf].
{only available when compiled with the |+float| feature}
+tempname() *tempname()* *temp-file-name*
+ The result is a String, which is the name of a file that
+ doesn't exist. It can be used for a temporary file. The name
+ is different for at least 26 consecutive calls. Example: >
+ :let tmpfile = tempname()
+ :exe "redir > " . tmpfile
+< For Unix, the file will be in a private directory |tempfile|.
+ For MS-Windows forward slashes are used when the 'shellslash'
+ option is set or when 'shellcmdflag' starts with '-'.
+
+
+test_garbagecollect_now() *test_garbagecollect_now()*
+ Like garbagecollect(), but executed right away. This must
+ only be called directly to avoid any structure to exist
+ internally, and |v:testing| must have been set before calling
+ any function.
+
+test_null_channel() *test_null_channel()*
+ Return a Channel that is null. Only useful for testing.
+ {only available when compiled with the +channel feature}
+
+test_null_dict() *test_null_dict()*
+ Return a Dict that is null. Only useful for testing.
+
+test_null_job() *test_null_job()*
+ Return a Job that is null. Only useful for testing.
+ {only available when compiled with the +job feature}
+
+test_null_list() *test_null_list()*
+ Return a List that is null. Only useful for testing.
+
+test_null_partial() *test_null_partial()*
+ Return a Partial that is null. Only useful for testing.
+
+test_null_string() *test_null_string()*
+ Return a String that is null. Only useful for testing.
+
+
*timer_start()*
timer_start({time}, {callback} [, {options}])
Create a timer and return the timer ID.
static void f_foreground(typval_T *argvars, typval_T *rettv);
static void f_function(typval_T *argvars, typval_T *rettv);
static void f_garbagecollect(typval_T *argvars, typval_T *rettv);
-static void f_garbagecollect_for_testing(typval_T *argvars, typval_T *rettv);
static void f_get(typval_T *argvars, typval_T *rettv);
static void f_getbufline(typval_T *argvars, typval_T *rettv);
static void f_getbufvar(typval_T *argvars, typval_T *rettv);
static void f_taglist(typval_T *argvars, typval_T *rettv);
static void f_tagfiles(typval_T *argvars, typval_T *rettv);
static void f_tempname(typval_T *argvars, typval_T *rettv);
-static void f_test(typval_T *argvars, typval_T *rettv);
+static void f_test_garbagecollect_now(typval_T *argvars, typval_T *rettv);
+#ifdef FEAT_JOB_CHANNEL
+static void f_test_null_channel(typval_T *argvars, typval_T *rettv);
+#endif
+static void f_test_null_dict(typval_T *argvars, typval_T *rettv);
+#ifdef FEAT_JOB_CHANNEL
+static void f_test_null_job(typval_T *argvars, typval_T *rettv);
+#endif
+static void f_test_null_list(typval_T *argvars, typval_T *rettv);
+static void f_test_null_partial(typval_T *argvars, typval_T *rettv);
+static void f_test_null_string(typval_T *argvars, typval_T *rettv);
#ifdef FEAT_FLOAT
static void f_tan(typval_T *argvars, typval_T *rettv);
static void f_tanh(typval_T *argvars, typval_T *rettv);
/*
* Do garbage collection for lists and dicts.
- * When "testing" is TRUE this is called from garbagecollect_for_testing().
+ * When "testing" is TRUE this is called from test_garbagecollect_now().
* Return TRUE if some memory was freed.
*/
int
{"foreground", 0, 0, f_foreground},
{"function", 1, 3, f_function},
{"garbagecollect", 0, 1, f_garbagecollect},
- {"garbagecollect_for_testing", 0, 0, f_garbagecollect_for_testing},
{"get", 2, 3, f_get},
{"getbufline", 2, 3, f_getbufline},
{"getbufvar", 2, 3, f_getbufvar},
{"tanh", 1, 1, f_tanh},
#endif
{"tempname", 0, 0, f_tempname},
- {"test", 1, 1, f_test},
+ {"test_garbagecollect_now", 0, 0, f_test_garbagecollect_now},
+#ifdef FEAT_JOB_CHANNEL
+ {"test_null_channel", 0, 0, f_test_null_channel},
+#endif
+ {"test_null_dict", 0, 0, f_test_null_dict},
+#ifdef FEAT_JOB_CHANNEL
+ {"test_null_job", 0, 0, f_test_null_job},
+#endif
+ {"test_null_list", 0, 0, f_test_null_list},
+ {"test_null_partial", 0, 0, f_test_null_partial},
+ {"test_null_string", 0, 0, f_test_null_string},
#ifdef FEAT_TIMERS
{"timer_start", 2, 3, f_timer_start},
{"timer_stop", 1, 1, f_timer_stop},
garbage_collect_at_exit = TRUE;
}
-/*
- * "garbagecollect_for_testing()" function
- */
- static void
-f_garbagecollect_for_testing(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
-{
- /* This is dangerous, any Lists and Dicts used internally may be freed
- * while still in use. */
- garbage_collect(TRUE);
-}
-
/*
* "get()" function
*/
} while (x == 'I' || x == 'O');
}
-/*
- * "test(list)" function: Just checking the walls...
- */
- static void
-f_test(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
-{
- /* Used for unit testing. Change the code below to your liking. */
-#if 0
- listitem_T *li;
- list_T *l;
- char_u *bad, *good;
-
- if (argvars[0].v_type != VAR_LIST)
- return;
- l = argvars[0].vval.v_list;
- if (l == NULL)
- return;
- li = l->lv_first;
- if (li == NULL)
- return;
- bad = get_tv_string(&li->li_tv);
- li = li->li_next;
- if (li == NULL)
- return;
- good = get_tv_string(&li->li_tv);
- rettv->vval.v_number = test_edit_score(bad, good);
-#endif
-}
-
#ifdef FEAT_FLOAT
/*
* "tan()" function
}
#endif
+/*
+ * "test_garbagecollect_now()" function
+ */
+ static void
+f_test_garbagecollect_now(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
+{
+ /* This is dangerous, any Lists and Dicts used internally may be freed
+ * while still in use. */
+ garbage_collect(TRUE);
+}
+
+#ifdef FEAT_JOB_CHANNEL
+ static void
+f_test_null_channel(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
+{
+ rettv->v_type = VAR_CHANNEL;
+ rettv->vval.v_channel = NULL;
+}
+#endif
+
+ static void
+f_test_null_dict(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
+{
+ rettv->v_type = VAR_DICT;
+ rettv->vval.v_dict = NULL;
+}
+
+#ifdef FEAT_JOB_CHANNEL
+ static void
+f_test_null_job(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
+{
+ rettv->v_type = VAR_JOB;
+ rettv->vval.v_job = NULL;
+}
+#endif
+
+ static void
+f_test_null_list(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
+{
+ rettv->v_type = VAR_LIST;
+ rettv->vval.v_list = NULL;
+}
+
+ static void
+f_test_null_partial(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
+{
+ rettv->v_type = VAR_PARTIAL;
+ rettv->vval.v_partial = NULL;
+}
+
+ static void
+f_test_null_string(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
+{
+ rettv->v_type = VAR_STRING;
+ rettv->vval.v_string = NULL;
+}
+
#if defined(FEAT_JOB_CHANNEL) || defined(FEAT_TIMERS) || defined(PROTO)
/*
* Get a callback from "arg". It can be a Funcref or a function name.