Assert and the optional Message

Jacob Carlborg doob at me.com
Sun Mar 11 05:09:56 PDT 2012


On 2012-03-10 17:58, Jonathan M Davis wrote:

> 2. As long as unit tests are properly isolated, then it's unlikely to be a big
> issue, and even if it _is_ problem, it's only a problem as long as tests are
> failing. So, while this may cause problems in some cases, it's still arguably
> worth it, since the _first_ test failure is still completely valid (as it is
> now), and the rest are _likely_ to be valid, so you'd generally be getting
> more information than before.

Yeah, it's only a problem when a test is failing. But I don't want the 
whole unit test run to potentially crash because of a failing unit test.

> If it's a big enough problem, it could probably be made so that AssertErrors
> are treated differently in unit tests such that they _are_ guaranteed to hit
> destructors, scope statements, and finally. But the basic design of Errors is
> that they're supposed to be unrecoverable, so skipping all of those isn't
> generally an issue. And given that can get Errors thrown from nothrow
> functions, running them might actually do funny things in some cases, because
> the assumptions surrounding nothrow have been effectively violated.
>
> - Jonathan M Davis

I understand that you're not supposed to catch errors but this needs to 
be fixed somehow. I don't know what's the best solution would be but I 
do know we need to find one.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list