Review: A new stab at a potential std.unittests

Jonathan M Davis jmdavisProg at gmx.com
Sat Nov 20 16:42:03 PST 2010


On Saturday 20 November 2010 10:23:36 Andrej Mitrovic wrote:
> What about debug vs release compilation for this new module?
> 
> We know we have assert for debug mode, and enforce for release mode
> (except the special assert false case). If I want assertExcThrown to
> be compiled in release mode it seems I'd need an enforced version of
> it, possibly called enforceExcThrown that uses enforce internally.
> 
> I'd prefer if we could somehow mark assert's to be compiled in release
> mode instead of having to duplicate code for assert and enforce
> versions of these new unittest functions.

It's specifically versioned on unittest. So, if you have unit tests enable, 
they'll be compiled in. If you don't, then they won't. Their entire purpose is 
for improving unit tests, and they aren't really intended for use anywhere else. 
And since they all throw AssertError on failure, they would be exactly as useful 
as an assert would be if it were compiled in.

Why would you be looking to use them outside of unit tests? What would you be 
trying to do with them?

- Jonathan M Davis


More information about the Digitalmars-d mailing list