version(assert) and Phobos release unittest build

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Thu Nov 28 07:58:16 PST 2013


On 28/11/13 16:48, Dicebot wrote:
> I think using assert for unittests is a mistake if you ever going to test
> release builds. `std.exception.enforce` or something similar is a better match.

I'm testing an in-contract, as it happens.

The point is that code inside version(assert) should only be included if assert 
expressions are enabled, as described at http://dlang.org/version.html.  But 
even with version(assert) conditionals in place, the assertThrown is still called.


More information about the Digitalmars-d-learn mailing list