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/src/globals.h b/src/globals.h
index d921a4e..54a1d72 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1619,6 +1619,15 @@
EXTERN int ignored;
EXTERN char *ignoredp;
+#ifdef FEAT_EVAL
+/* set by alloc_fail(): ID */
+EXTERN int alloc_fail_id INIT(= 0);
+/* set by alloc_fail(), when zero alloc() returns NULL */
+EXTERN int alloc_fail_countdown INIT(= -1);
+/* set by alloc_fail(), number of times alloc() returns NULL */
+EXTERN int alloc_fail_repeat INIT(= 0);
+#endif
+
/*
* Optional Farsi support. Include it here, so EXTERN and INIT are defined.
*/