diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-05-25 21:23:21 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-05-25 21:23:21 +0200 |
commit | 8e8df251bf2505e5decf258397c6069fbe5e2e01 (patch) | |
tree | a2326994d025d4a6e143104e221c499b54357481 /src | |
parent | 2177f9fe18a927ef65ccebb0856722a28dc00252 (diff) | |
download | vim-git-8e8df251bf2505e5decf258397c6069fbe5e2e01.tar.gz |
patch 7.4.1844v7.4.1844
Problem: Using old function name in comment. More functions should start
with test_.
Solution: Rename function in comment. (Higashi Higashi) Rename
disable_char_avail_for_testing() to test_disable_char_avail().
And alloc_fail() to test_alloc_fail().
Diffstat (limited to 'src')
-rw-r--r-- | src/eval.c | 74 | ||||
-rw-r--r-- | src/getchar.c | 2 | ||||
-rw-r--r-- | src/testdir/runtest.vim | 2 | ||||
-rw-r--r-- | src/testdir/test_cursor_func.vim | 4 | ||||
-rw-r--r-- | src/testdir/test_quickfix.vim | 10 | ||||
-rw-r--r-- | src/version.c | 2 |
6 files changed, 48 insertions, 46 deletions
diff --git a/src/eval.c b/src/eval.c index 41f98d2fa..c8d84c5d5 100644 --- a/src/eval.c +++ b/src/eval.c @@ -472,7 +472,6 @@ static void f_abs(typval_T *argvars, typval_T *rettv); static void f_acos(typval_T *argvars, typval_T *rettv); #endif static void f_add(typval_T *argvars, typval_T *rettv); -static void f_alloc_fail(typval_T *argvars, typval_T *rettv); static void f_and(typval_T *argvars, typval_T *rettv); static void f_append(typval_T *argvars, typval_T *rettv); static void f_argc(typval_T *argvars, typval_T *rettv); @@ -549,7 +548,6 @@ static void f_delete(typval_T *argvars, typval_T *rettv); static void f_did_filetype(typval_T *argvars, typval_T *rettv); static void f_diff_filler(typval_T *argvars, typval_T *rettv); static void f_diff_hlID(typval_T *argvars, typval_T *rettv); -static void f_disable_char_avail_for_testing(typval_T *argvars, typval_T *rettv); static void f_empty(typval_T *argvars, typval_T *rettv); static void f_escape(typval_T *argvars, typval_T *rettv); static void f_eval(typval_T *argvars, typval_T *rettv); @@ -805,6 +803,8 @@ static void f_tabpagewinnr(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_alloc_fail(typval_T *argvars, typval_T *rettv); +static void f_test_disable_char_avail(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); @@ -8344,7 +8344,6 @@ static struct fst {"acos", 1, 1, f_acos}, /* WJMc */ #endif {"add", 2, 2, f_add}, - {"alloc_fail", 3, 3, f_alloc_fail}, {"and", 2, 2, f_and}, {"append", 2, 2, f_append}, {"argc", 0, 0, f_argc}, @@ -8425,7 +8424,6 @@ static struct fst {"did_filetype", 0, 0, f_did_filetype}, {"diff_filler", 1, 1, f_diff_filler}, {"diff_hlID", 2, 2, f_diff_hlID}, - {"disable_char_avail_for_testing", 1, 1, f_disable_char_avail_for_testing}, {"empty", 1, 1, f_empty}, {"escape", 2, 2, f_escape}, {"eval", 1, 1, f_eval}, @@ -8689,6 +8687,8 @@ static struct fst {"tanh", 1, 1, f_tanh}, #endif {"tempname", 0, 0, f_tempname}, + {"test_alloc_fail", 3, 3, f_test_alloc_fail}, + {"test_disable_char_avail", 1, 1, f_test_disable_char_avail}, {"test_garbagecollect_now", 0, 0, f_test_garbagecollect_now}, #ifdef FEAT_JOB_CHANNEL {"test_null_channel", 0, 0, f_test_null_channel}, @@ -8949,7 +8949,7 @@ get_func_tv( if (get_vim_var_nr(VV_TESTING)) { - /* Prepare for calling garbagecollect_for_testing(), need to know + /* Prepare for calling test_garbagecollect_now(), need to know * what variables are used on the call stack. */ if (funcargs.ga_itemsize == 0) ga_init2(&funcargs, (int)sizeof(typval_T *), 50); @@ -9381,29 +9381,6 @@ f_add(typval_T *argvars, typval_T *rettv) } /* - * "alloc_fail(id, countdown, repeat)" function - */ - static void -f_alloc_fail(typval_T *argvars, typval_T *rettv UNUSED) -{ - if (argvars[0].v_type != VAR_NUMBER - || argvars[0].vval.v_number <= 0 - || argvars[1].v_type != VAR_NUMBER - || argvars[1].vval.v_number < 0 - || argvars[2].v_type != VAR_NUMBER) - EMSG(_(e_invarg)); - else - { - alloc_fail_id = argvars[0].vval.v_number; - if (alloc_fail_id >= aid_last) - EMSG(_(e_invarg)); - alloc_fail_countdown = argvars[1].vval.v_number; - alloc_fail_repeat = argvars[2].vval.v_number; - did_outofmem_msg = FALSE; - } -} - -/* * "and(expr, expr)" function */ static void @@ -11115,15 +11092,6 @@ f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED) } /* - * "disable_char_avail_for_testing({expr})" function - */ - static void -f_disable_char_avail_for_testing(typval_T *argvars, typval_T *rettv UNUSED) -{ - disable_char_avail_for_testing = get_tv_number(&argvars[0]); -} - -/* * "empty({expr})" function */ static void @@ -20691,6 +20659,38 @@ f_tanh(typval_T *argvars, typval_T *rettv) #endif /* + * "test_alloc_fail(id, countdown, repeat)" function + */ + static void +f_test_alloc_fail(typval_T *argvars, typval_T *rettv UNUSED) +{ + if (argvars[0].v_type != VAR_NUMBER + || argvars[0].vval.v_number <= 0 + || argvars[1].v_type != VAR_NUMBER + || argvars[1].vval.v_number < 0 + || argvars[2].v_type != VAR_NUMBER) + EMSG(_(e_invarg)); + else + { + alloc_fail_id = argvars[0].vval.v_number; + if (alloc_fail_id >= aid_last) + EMSG(_(e_invarg)); + alloc_fail_countdown = argvars[1].vval.v_number; + alloc_fail_repeat = argvars[2].vval.v_number; + did_outofmem_msg = FALSE; + } +} + +/* + * "test_disable_char_avail({expr})" function + */ + static void +f_test_disable_char_avail(typval_T *argvars, typval_T *rettv UNUSED) +{ + disable_char_avail_for_testing = get_tv_number(&argvars[0]); +} + +/* * "test_garbagecollect_now()" function */ static void diff --git a/src/getchar.c b/src/getchar.c index c771117ad..81cb83794 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -1880,7 +1880,7 @@ char_avail(void) int retval; #ifdef FEAT_EVAL - /* When disable_char_avail_for_testing(1) was called pretend there is no + /* When test_disable_char_avail(1) was called pretend there is no * typeahead. */ if (disable_char_avail_for_testing) return FALSE; diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim index 2b38981bb..57edcc17c 100644 --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -60,7 +60,7 @@ let $HOME = '/does/not/exist' let s:srcdir = expand('%:p:h:h') -" Prepare for calling garbagecollect_for_testing(). +" Prepare for calling test_garbagecollect_now(). let v:testing = 1 " Support function: get the alloc ID by name. diff --git a/src/testdir/test_cursor_func.vim b/src/testdir/test_cursor_func.vim index d3236e6e0..4b2a9b8f8 100644 --- a/src/testdir/test_cursor_func.vim +++ b/src/testdir/test_cursor_func.vim @@ -44,9 +44,9 @@ func Test_curswant_with_autocommand() new call setline(1, ['func()', '{', '}', '----']) autocmd! CursorMovedI * call s:Highlight_Matching_Pair() - call disable_char_avail_for_testing(1) + call test_disable_char_avail(1) exe "normal! 3Ga\<Down>X\<Esc>" - call disable_char_avail_for_testing(0) + call test_disable_char_avail(0) call assert_equal('-X---', getline(4)) autocmd! CursorMovedI * quit! diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index e00230360..242247dfe 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -280,19 +280,19 @@ function Test_cbuffer() endfunction function Test_nomem() - call alloc_fail(GetAllocId('qf_dirname_start'), 0, 0) + call test_alloc_fail(GetAllocId('qf_dirname_start'), 0, 0) call assert_fails('vimgrep vim runtest.vim', 'E342:') - call alloc_fail(GetAllocId('qf_dirname_now'), 0, 0) + call test_alloc_fail(GetAllocId('qf_dirname_now'), 0, 0) call assert_fails('vimgrep vim runtest.vim', 'E342:') - call alloc_fail(GetAllocId('qf_namebuf'), 0, 0) + call test_alloc_fail(GetAllocId('qf_namebuf'), 0, 0) call assert_fails('cfile runtest.vim', 'E342:') - call alloc_fail(GetAllocId('qf_errmsg'), 0, 0) + call test_alloc_fail(GetAllocId('qf_errmsg'), 0, 0) call assert_fails('cfile runtest.vim', 'E342:') - call alloc_fail(GetAllocId('qf_pattern'), 0, 0) + call test_alloc_fail(GetAllocId('qf_pattern'), 0, 0) call assert_fails('cfile runtest.vim', 'E342:') endfunc diff --git a/src/version.c b/src/version.c index 678bf2a34..8de127946 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1844, +/**/ 1843, /**/ 1842, |