Bram Moolenaar <[email protected]> wrote:

>
> Ben Fritz wrote:
>
>> So, is the intent to eventually replace *all* memory allocations with
>> this no allow testing error handling code? Or just specific areas?
>> Example, I don't see testing of the error handling in the garbage
>> collector.
>
> That would be a lot of work.  At least this helps someone who wants to
> get 100% coverage for some part of the code.
>
>> Wouldn't it be better to use an enum rather than a comment about the
>> current max ID? Much easier to search that way and less error-prone.
>
> It would require an enum with fixed numbers.  Otherwise removing an
> entry would break tests, since those will need to use numbers.
> Might as well just use the number.  It doesn't matter if there are gaps.
> If the same number is used twice there is no error, but the test might
> fail.  Or it might just work.

SQLite is tested with 100% coverage, including error paths
with dynamic allocation failure (OOM), I/O errors, etc.
Some information can be found here:

https://www.sqlite.org/malloc.html
https://www.sqlite.org/testing.html

But probably this is overkill for Vim.

Perhaps something easier is to inject, for test purpose,
some random allocation failures and test with asan.

Regards
Dominique

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui