1
0
forked from aniani/vim

patch 8.0.0440: not enough test coverage in Insert mode

Problem:    Not enough test coverage in Insert mode.
Solution:   Add lots of tests.  Add test_override(). (Christian Brabandt,
            closes #1521)
This commit is contained in:
Bram Moolenaar
2017-03-09 18:20:16 +01:00
parent 69a92fb5ae
commit eb992cb90f
13 changed files with 1386 additions and 15 deletions

View File

@@ -390,7 +390,7 @@ static void f_tagfiles(typval_T *argvars, typval_T *rettv);
static void f_tempname(typval_T *argvars, typval_T *rettv);
static void f_test_alloc_fail(typval_T *argvars, typval_T *rettv);
static void f_test_autochdir(typval_T *argvars, typval_T *rettv);
static void f_test_disable_char_avail(typval_T *argvars, typval_T *rettv);
static void f_test_override(typval_T *argvars, typval_T *rettv);
static void f_test_garbagecollect_now(typval_T *argvars, typval_T *rettv);
static void f_test_ignore_error(typval_T *argvars, typval_T *rettv);
#ifdef FEAT_JOB_CHANNEL
@@ -828,7 +828,6 @@ static struct fst
{"tempname", 0, 0, f_tempname},
{"test_alloc_fail", 3, 3, f_test_alloc_fail},
{"test_autochdir", 0, 0, f_test_autochdir},
{"test_disable_char_avail", 1, 1, f_test_disable_char_avail},
{"test_garbagecollect_now", 0, 0, f_test_garbagecollect_now},
{"test_ignore_error", 1, 1, f_test_ignore_error},
#ifdef FEAT_JOB_CHANNEL
@@ -841,6 +840,7 @@ static struct fst
{"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},
{"test_override", 2, 2, f_test_override},
{"test_settime", 1, 1, f_test_settime},
#ifdef FEAT_TIMERS
{"timer_info", 0, 1, f_timer_info},
@@ -12326,12 +12326,34 @@ f_test_autochdir(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
}
/*
* "test_disable_char_avail({expr})" function
* "test_disable({name}, {val})" function
*/
static void
f_test_disable_char_avail(typval_T *argvars, typval_T *rettv UNUSED)
f_test_override(typval_T *argvars, typval_T *rettv UNUSED)
{
disable_char_avail_for_testing = (int)get_tv_number(&argvars[0]);
char_u *name = (char_u *)"";
int val;
if (argvars[0].v_type != VAR_STRING
|| (argvars[1].v_type) != VAR_NUMBER)
EMSG(_(e_invarg));
else
{
name = get_tv_string_chk(&argvars[0]);
val = (int)get_tv_number(&argvars[1]);
if (STRCMP(name, (char_u *)"redraw") == 0)
disable_redraw_for_testing = val;
else if (STRCMP(name, (char_u *)"char_avail") == 0)
disable_char_avail_for_testing = val;
else if (STRCMP(name, (char_u *)"ALL") == 0)
{
disable_char_avail_for_testing = FALSE;
disable_redraw_for_testing = FALSE;
}
else
EMSG2(_(e_invarg2), name);
}
}
/*