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.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 10780bf..c2a5965 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1739,6 +1739,8 @@
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 @@
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.