1
0
forked from aniani/vim

patch 7.4.1058

Problem:    It is not possible to test code that is only reached when memory
            allocation fails.
Solution:   Add the alloc_fail() function.  Try it out with :vimgrep.
This commit is contained in:
Bram Moolenaar
2016-01-07 21:25:08 +01:00
parent 2b7db933b0
commit 75bdf6aa30
8 changed files with 138 additions and 5 deletions

View File

@@ -1739,6 +1739,8 @@ USAGE RESULT DESCRIPTION ~
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( {countdown}, {when}, {repeat})
nothing 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}
@@ -2118,6 +2120,13 @@ add({list}, {expr}) *add()*
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.