mirror of
https://github.com/vim/vim.git
synced 2025-07-24 10:45:12 -04:00
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:
parent
69a92fb5ae
commit
eb992cb90f
@ -2360,7 +2360,6 @@ tempname() String name for a temporary file
|
||||
test_alloc_fail({id}, {countdown}, {repeat})
|
||||
none make memory allocation fail
|
||||
test_autochdir() none enable 'autochdir' during startup
|
||||
test_disable_char_avail({expr}) none test without typeahead
|
||||
test_garbagecollect_now() none free memory right now for testing
|
||||
test_ignore_error({expr}) none ignore a specific error
|
||||
test_null_channel() Channel null value for testing
|
||||
@ -2369,6 +2368,7 @@ 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
|
||||
test_override({expr}, {val}) none test with Vim internal overrides
|
||||
test_settime({expr}) none set current time for testing
|
||||
timer_info([{id}]) List information about timers
|
||||
timer_pause({id}, {pause}) none pause or unpause a timer
|
||||
|
@ -2111,6 +2111,7 @@ test_arglist \
|
||||
test_digraph \
|
||||
test_functions \
|
||||
test_display \
|
||||
test_edit \
|
||||
test_ex_undo \
|
||||
test_execute_func \
|
||||
test_expand \
|
||||
|
@ -2262,7 +2262,10 @@ has_compl_option(int dict_opt)
|
||||
vim_beep(BO_COMPL);
|
||||
setcursor();
|
||||
out_flush();
|
||||
ui_delay(2000L, FALSE);
|
||||
#ifdef FEAT_EVAL
|
||||
if (!get_vim_var_nr(VV_TESTING))
|
||||
#endif
|
||||
ui_delay(2000L, FALSE);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1648,7 +1648,9 @@ EXTERN int alloc_fail_countdown INIT(= -1);
|
||||
/* set by alloc_fail(), number of times alloc() returns NULL */
|
||||
EXTERN int alloc_fail_repeat INIT(= 0);
|
||||
|
||||
/* flags set by test_override() */
|
||||
EXTERN int disable_char_avail_for_testing INIT(= 0);
|
||||
EXTERN int disable_redraw_for_testing INIT(= 0);
|
||||
|
||||
EXTERN int in_free_unref_items INIT(= FALSE);
|
||||
#endif
|
||||
|
@ -10580,7 +10580,12 @@ fillchar_vsep(int *attr)
|
||||
int
|
||||
redrawing(void)
|
||||
{
|
||||
return (!RedrawingDisabled
|
||||
#ifdef FEAT_EVAL
|
||||
if (disable_redraw_for_testing)
|
||||
return 0;
|
||||
else
|
||||
#endif
|
||||
return (!RedrawingDisabled
|
||||
&& !(p_lz && char_avail() && !KeyTyped && !do_redraw));
|
||||
}
|
||||
|
||||
|
@ -151,6 +151,7 @@ NEW_TESTS = test_arabic.res \
|
||||
test_diffmode.res \
|
||||
test_digraph.res \
|
||||
test_display.res \
|
||||
test_edit.res \
|
||||
test_farsi.res \
|
||||
test_fnameescape.res \
|
||||
test_fold.res \
|
||||
|
@ -49,7 +49,7 @@ source setup.vim
|
||||
" This also enables use of line continuation.
|
||||
set nocp viminfo+=nviminfo
|
||||
|
||||
" Use utf-8 or latin1 be default, instead of whatever the system default
|
||||
" Use utf-8 or latin1 by default, instead of whatever the system default
|
||||
" happens to be. Individual tests can overrule this at the top of the file.
|
||||
if has('multi_byte')
|
||||
set encoding=utf-8
|
||||
@ -96,6 +96,9 @@ function RunTheTest(test)
|
||||
" mode message.
|
||||
set noshowmode
|
||||
|
||||
" Clear any overrides.
|
||||
call test_override('ALL', 0)
|
||||
|
||||
if exists("*SetUp")
|
||||
try
|
||||
call SetUp()
|
||||
|
@ -127,6 +127,14 @@ func Test_assert_with_msg()
|
||||
call remove(v:errors, 0)
|
||||
endfunc
|
||||
|
||||
func Test_override()
|
||||
call test_override('char_avail', 1)
|
||||
call test_override('redraw', 1)
|
||||
call test_override('ALL', 0)
|
||||
call assert_fails("call test_override('xxx', 1)", 'E475')
|
||||
call assert_fails("call test_override('redraw', 'yes')", 'E474')
|
||||
endfunc
|
||||
|
||||
func Test_user_is_happy()
|
||||
smile
|
||||
sleep 300m
|
||||
|
@ -44,9 +44,9 @@ func Test_curswant_with_autocommand()
|
||||
new
|
||||
call setline(1, ['func()', '{', '}', '----'])
|
||||
autocmd! CursorMovedI * call s:Highlight_Matching_Pair()
|
||||
call test_disable_char_avail(1)
|
||||
call test_override("char_avail", 1)
|
||||
exe "normal! 3Ga\<Down>X\<Esc>"
|
||||
call test_disable_char_avail(0)
|
||||
call test_override("char_avail", 0)
|
||||
call assert_equal('-X---', getline(4))
|
||||
autocmd! CursorMovedI *
|
||||
quit!
|
||||
|
1324
src/testdir/test_edit.vim
Normal file
1324
src/testdir/test_edit.vim
Normal file
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@ func Test_search_cmdline()
|
||||
endif
|
||||
" need to disable char_avail,
|
||||
" so that expansion of commandline works
|
||||
call test_disable_char_avail(1)
|
||||
call test_override("char_avail", 1)
|
||||
new
|
||||
call setline(1, [' 1', ' 2 these', ' 3 the', ' 4 their', ' 5 there', ' 6 their', ' 7 the', ' 8 them', ' 9 these', ' 10 foobar'])
|
||||
" Test 1
|
||||
@ -194,7 +194,7 @@ func Test_search_cmdline()
|
||||
call assert_equal(' 3 the', getline('.'))
|
||||
|
||||
" clean up
|
||||
call test_disable_char_avail(0)
|
||||
call test_override("char_avail", 0)
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
@ -204,7 +204,7 @@ func Test_search_cmdline2()
|
||||
endif
|
||||
" need to disable char_avail,
|
||||
" so that expansion of commandline works
|
||||
call test_disable_char_avail(1)
|
||||
call test_override("char_avail", 1)
|
||||
new
|
||||
call setline(1, [' 1', ' 2 these', ' 3 the theother'])
|
||||
" Test 1
|
||||
@ -266,7 +266,7 @@ func Test_search_cmdline2()
|
||||
|
||||
" clean up
|
||||
set noincsearch
|
||||
call test_disable_char_avail(0)
|
||||
call test_override("char_avail", 0)
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
|
@ -764,6 +764,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
440,
|
||||
/**/
|
||||
439,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user