Extending unittests [proposal] [Proof Of Concept]
Jens Mueller
jens.k.mueller at gmx.de
Fri Sep 21 14:11:23 PDT 2012
Jacob Carlborg wrote:
> On 2012-09-21 20:01, Johannes Pfau wrote:
>
> >I didn't think of setAssertHandler. My changes are perfectly compatible
> >with it.
> >IIRC setAssertHandler has the small downside that it's used for all
> >asserts, not only those used in unit tests? I'm not sure if that's a
> >drawback or actually useful.
>
> That's no problem, there's a predefined version, "unittest", when
> you pass the -unittest flag to the compiler:
>
> version (unittest)
> setAssertHandler(myUnitTestSpecificAssertHandler);
But if you have an assert in some algorithm to ensure some invariant or
in a contract it will be handled by myUnitTestSpecificAssertHandler.
But I think that is not a drawback. Don't you want to no whenever an
assert is violated?
Jens
More information about the Digitalmars-d
mailing list