Mercurial > vim
diff runtime/doc/eval.txt @ 7513:37e061ec063c v7.4.1058
commit https://github.com/vim/vim/commit/75bdf6aa30a5c99d67c42886cf7a4a000bbaa422
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 7 21:25:08 2016 +0100
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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 07 Jan 2016 21:30:05 +0100 |
parents | a49163681559 |
children | 502ca0a62fd8 |
line wrap: on
line diff
--- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -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.