Program logic bugs vs input/environmental errors

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 16 12:35:39 PDT 2014


On 10/16/2014 12:21 PM, Dicebot wrote:
> On Thursday, 16 October 2014 at 06:11:46 UTC, Jacob Carlborg wrote:
>> On 2014-10-15 16:25, Dicebot wrote:
>>
>>> How can one continue without recovering? This will result in any kind of
>>> environment not being cleaned and false failures of other tests that
>>> share it.
>>
>> I will probably use something else than "assert" in my unit tests. Something
>> like assertEq, assertNotEq and so on. It's more flexible, can give better
>> error message and I can have it throw an exception instead of an error. But
>> there's still the problem with asserts in contracts and other parts of the code.
>
> This is what we are using right now:
>
> public void test ( char[] op, T1, T2 ) ( T1 a, T2 b, char[] file = __FILE__,
> size_t line = __LINE__ )
> {
>      enforce!(op, TestException)(a, b, file, line);
> }
>
> but it won't work well with 3d-party libraries that use assertions.

Ok, but why would 3rd party library unittests be a concern? They shouldn't have 
shipped it if their own unittests fail - that's the whole point of having unittests.


More information about the Digitalmars-d mailing list