0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 7.4.1096

Problem:    Need several lines to verify a command produces an error.
Solution:   Add assert_fails(). (suggested by Nikolay Pavlov)
            Make the quickfix alloc test actually work.
This commit is contained in:
Bram Moolenaar
2016-01-15 20:48:22 +01:00
parent 3d6d5cc3a4
commit a260b87d9d
6 changed files with 71 additions and 28 deletions

View File

@@ -798,13 +798,17 @@ vim_mem_profile_dump()
#endif /* MEM_PROFILE */
#ifdef FEAT_EVAL
static int alloc_does_fail __ARGS((long_u size));
static int
alloc_does_fail()
alloc_does_fail(size)
long_u size;
{
if (alloc_fail_countdown == 0)
{
if (--alloc_fail_repeat <= 0)
alloc_fail_id = 0;
do_outofmem_msg(size);
return TRUE;
}
--alloc_fail_countdown;
@@ -844,7 +848,7 @@ alloc_id(size, id)
alloc_id_T id UNUSED;
{
#ifdef FEAT_EVAL
if (alloc_fail_id == id && alloc_does_fail())
if (alloc_fail_id == id && alloc_does_fail((long_u)size))
return NULL;
#endif
return (lalloc((long_u)size, TRUE));
@@ -1008,7 +1012,7 @@ lalloc_id(size, message, id)
alloc_id_T id UNUSED;
{
#ifdef FEAT_EVAL
if (alloc_fail_id == id && alloc_does_fail())
if (alloc_fail_id == id && alloc_does_fail(size))
return NULL;
#endif
return (lalloc((long_u)size, message));