Patch 7.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().
Files: src/eval.c, src/getchar.c, src/testdir/runtest.vim,
src/testdir/test_cursor_func.vim, src/testdir/test_quickfix.vim,
runtime/doc/eval.txt
*** ../vim-7.4.1843/src/eval.c 2016-05-24 22:29:45.038961566 +0200
--- src/eval.c 2016-05-25 21:21:46.113829174 +0200
***************
*** 472,478 ****
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);
--- 472,477 ----
***************
*** 549,555 ****
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);
--- 548,553 ----
***************
*** 805,810 ****
--- 803,810 ----
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,8350 ****
{"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},
--- 8344,8349 ----
***************
*** 8425,8431 ****
{"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},
--- 8424,8429 ----
***************
*** 8689,8694 ****
--- 8687,8694 ----
{"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,8955 ****
if (get_vim_var_nr(VV_TESTING))
{
! /* Prepare for calling garbagecollect_for_testing(), need to know
* what variables are used on the call stack. */
if (funcargs.ga_itemsize == 0)
ga_init2(&funcargs, (int)sizeof(typval_T *), 50);
--- 8949,8955 ----
if (get_vim_var_nr(VV_TESTING))
{
! /* 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,9409 ****
}
/*
- * "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
--- 9381,9386 ----
***************
*** 11115,11129 ****
}
/*
- * "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
--- 11092,11097 ----
***************
*** 20691,20696 ****
--- 20659,20696 ----
#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
*** ../vim-7.4.1843/src/getchar.c 2016-04-14 12:46:33.616678646 +0200
--- src/getchar.c 2016-05-25 20:52:14.265853547 +0200
***************
*** 1880,1886 ****
int retval;
#ifdef FEAT_EVAL
! /* When disable_char_avail_for_testing(1) was called pretend there is no
* typeahead. */
if (disable_char_avail_for_testing)
return FALSE;
--- 1880,1886 ----
int retval;
#ifdef FEAT_EVAL
! /* When test_disable_char_avail(1) was called pretend there is no
* typeahead. */
if (disable_char_avail_for_testing)
return FALSE;
*** ../vim-7.4.1843/src/testdir/runtest.vim 2016-04-14 12:46:33.620678603
+0200
--- src/testdir/runtest.vim 2016-05-25 20:50:01.225855377 +0200
***************
*** 60,66 ****
let s:srcdir = expand('%:p:h:h')
! " Prepare for calling garbagecollect_for_testing().
let v:testing = 1
" Support function: get the alloc ID by name.
--- 60,66 ----
let s:srcdir = expand('%:p:h:h')
! " Prepare for calling test_garbagecollect_now().
let v:testing = 1
" Support function: get the alloc ID by name.
*** ../vim-7.4.1843/src/testdir/test_cursor_func.vim 2016-02-10
22:23:02.256605792 +0100
--- src/testdir/test_cursor_func.vim 2016-05-25 20:53:31.125852490 +0200
***************
*** 44,52 ****
new
call setline(1, ['func()', '{', '}', '----'])
autocmd! CursorMovedI * call s:Highlight_Matching_Pair()
! call disable_char_avail_for_testing(1)
exe "normal! 3Ga\<Down>X\<Esc>"
! call disable_char_avail_for_testing(0)
call assert_equal('-X---', getline(4))
autocmd! CursorMovedI *
quit!
--- 44,52 ----
new
call setline(1, ['func()', '{', '}', '----'])
autocmd! CursorMovedI * call s:Highlight_Matching_Pair()
! call test_disable_char_avail(1)
exe "normal! 3Ga\<Down>X\<Esc>"
! call test_disable_char_avail(0)
call assert_equal('-X---', getline(4))
autocmd! CursorMovedI *
quit!
*** ../vim-7.4.1843/src/testdir/test_quickfix.vim 2016-05-24
19:59:48.203085324 +0200
--- src/testdir/test_quickfix.vim 2016-05-25 20:59:15.153847757 +0200
***************
*** 280,298 ****
endfunction
function Test_nomem()
! call 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 assert_fails('vimgrep vim runtest.vim', 'E342:')
! call alloc_fail(GetAllocId('qf_namebuf'), 0, 0)
call assert_fails('cfile runtest.vim', 'E342:')
! call alloc_fail(GetAllocId('qf_errmsg'), 0, 0)
call assert_fails('cfile runtest.vim', 'E342:')
! call alloc_fail(GetAllocId('qf_pattern'), 0, 0)
call assert_fails('cfile runtest.vim', 'E342:')
endfunc
--- 280,298 ----
endfunction
function Test_nomem()
! call test_alloc_fail(GetAllocId('qf_dirname_start'), 0, 0)
call assert_fails('vimgrep vim runtest.vim', 'E342:')
! call test_alloc_fail(GetAllocId('qf_dirname_now'), 0, 0)
call assert_fails('vimgrep vim runtest.vim', 'E342:')
! call test_alloc_fail(GetAllocId('qf_namebuf'), 0, 0)
call assert_fails('cfile runtest.vim', 'E342:')
! call test_alloc_fail(GetAllocId('qf_errmsg'), 0, 0)
call assert_fails('cfile runtest.vim', 'E342:')
! call test_alloc_fail(GetAllocId('qf_pattern'), 0, 0)
call assert_fails('cfile runtest.vim', 'E342:')
endfunc
*** ../vim-7.4.1843/runtime/doc/eval.txt 2016-05-24 22:29:45.042961566
+0200
--- runtime/doc/eval.txt 2016-05-25 20:57:36.153849119 +0200
***************
*** 1816,1823 ****
abs({expr}) Float or Number absolute value of {expr}
acos({expr}) Float arc cosine of {expr}
add({list}, {item}) List append {item} to |List| {list}
- alloc_fail({id}, {countdown}, {repeat})
- none make memory allocation fail
and({expr}, {expr}) Number bitwise AND
append({lnum}, {string}) Number append {string} below line {lnum}
append({lnum}, {list}) Number append lines {list} below line
{lnum}
--- 1835,1840 ----
***************
*** 1899,1906 ****
did_filetype() Number TRUE if FileType autocommand
event used
diff_filler({lnum}) Number diff filler lines about {lnum}
diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col}
- disable_char_avail_for_testing({expr})
- none test without typeahead
empty({expr}) Number TRUE if {expr} is empty
escape({string}, {chars}) String escape {chars} in {string} with '\'
eval({string}) any evaluate {string} into its value
--- 1916,1921 ----
***************
*** 2149,2162 ****
str2float({expr}) Float convert String to Float
str2nr({expr} [, {base}]) Number convert String to Number
strchars({expr} [, {skipcc}]) Number character length of the String {expr}
strdisplaywidth({expr} [, {col}]) Number display length of the String {expr}
strftime({format}[, {time}]) String time in specified format
stridx({haystack}, {needle}[, {start}])
Number index of {needle} in {haystack}
string({expr}) String String representation of {expr}
value
strlen({expr}) Number length of the String {expr}
! strpart({src}, {start}[, {len}])
! String {len} characters of {src} at {start}
strridx({haystack}, {needle} [, {start}])
Number last index of {needle} in {haystack}
strtrans({expr}) String translate string to make it printable
--- 2164,2180 ----
str2float({expr}) Float convert String to Float
str2nr({expr} [, {base}]) Number convert String to Number
strchars({expr} [, {skipcc}]) Number character length of the String {expr}
+ strcharpart({str}, {start}[, {len}])
+ String {len} characters of {str} at {start}
strdisplaywidth({expr} [, {col}]) Number display length of the String {expr}
strftime({format}[, {time}]) String time in specified format
+ strgetchar({str}, {index}) Number get char {index} from {str}
stridx({haystack}, {needle}[, {start}])
Number index of {needle} in {haystack}
string({expr}) String String representation of {expr}
value
strlen({expr}) Number length of the String {expr}
! strpart({str}, {start}[, {len}])
! String {len} characters of {str} at {start}
strridx({haystack}, {needle} [, {start}])
Number last index of {needle} in {haystack}
strtrans({expr}) String translate string to make it printable
***************
*** 2181,2186 ****
--- 2199,2207 ----
tan({expr}) Float tangent of {expr}
tanh({expr}) Float hyperbolic tangent of {expr}
tempname() String name for a temporary file
+ test_alloc_fail({id}, {countdown}, {repeat})
+ none make memory allocation fail
+ test_disable_char_avail({expr}) none test without typeahead
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
***************
*** 2263,2275 ****
Use |insert()| to add an item at another position.
- alloc_fail({id}, {countdown}, {repeat}) *alloc_fail()*
- This is for testing: If the memory allocation with {id} is
- called, then decrement {countdown}, and when it reaches zero
- let memory allocation fail {repeat} times. When {repeat} is
- smaller than one it fails one time.
-
-
and({expr}, {expr}) *and()*
Bitwise AND on the two arguments. The arguments are converted
to a number. A List, Dict or Float argument causes an error.
--- 2284,2289 ----
***************
*** 3143,3156 ****
The highlight ID can be used with |synIDattr()| to obtain
syntax information about the highlighting.
- *disable_char_avail_for_testing()*
- disable_char_avail_for_testing({expr})
- When {expr} is 1 the internal char_avail() function will
- return FALSE. When {expr} is 0 the char_avail() function will
- function normally.
- Only use this for a test where typeahead causes the test not
- to work. E.g., to trigger the CursorMovedI autocommand event.
-
empty({expr}) *empty()*
Return the Number 1 if {expr} is empty, zero otherwise.
- A |List| or |Dictionary| is empty when it does not have any
--- 3150,3155 ----
***************
*** 7088,7093 ****
--- 7197,7217 ----
option is set or when 'shellcmdflag' starts with '-'.
+ test_alloc_fail({id}, {countdown}, {repeat}) *test_alloc_fail()*
+ This is for testing: If the memory allocation with {id} is
+ called, then decrement {countdown}, and when it reaches zero
+ let memory allocation fail {repeat} times. When {repeat} is
+ smaller than one it fails one time.
+
+
+ *test_disable_char_avail()*
+ test_disable_char_avail({expr})
+ When {expr} is 1 the internal char_avail() function will
+ return FALSE. When {expr} is 0 the char_avail() function will
+ function normally.
+ Only use this for a test where typeahead causes the test not
+ to work. E.g., to trigger the CursorMovedI autocommand event.
+
test_garbagecollect_now() *test_garbagecollect_now()*
Like garbagecollect(), but executed right away. This must
only be called directly to avoid any structure to exist
*** ../vim-7.4.1843/src/version.c 2016-05-25 20:38:49.757864614 +0200
--- src/version.c 2016-05-25 21:20:09.301830505 +0200
***************
*** 755,756 ****
--- 755,758 ----
{ /* Add new patch number below this line */
+ /**/
+ 1844,
/**/
--
hundred-and-one symptoms of being an internet addict:
6. You refuse to go to a vacation spot with no electricity and no phone lines.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.