version(assert) and Phobos release unittest build
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Thu Nov 28 07:43:42 PST 2013
Hello all,
Some unittests I've been writing for Phobos involve using
assertThrown!AssertError to check that assert failures are indeed triggered
where they should be.
Surprise surprise, this fails on the release unittest build, because of course
the assertion statements are stripped out. I assumed that using version(assert)
{ ... } to surround the assertThrown statement would fix this, but it doesn't --
the assertThrown keeps being called and keeps claiming that no AssertError was
thrown.
I guess I could do version(release) {} { assertThrown(...); } but that seems
kind of ugly. Any alternatives?
Thanks & best wishes,
-- Joe
More information about the Digitalmars-d-learn
mailing list