assert(condition[, message]) patch

braddr at puremagic.com braddr at puremagic.com
Tue May 30 01:10:56 PDT 2006


In article <drrnko$2onm$1 at digitaldaemon.com>, braddr at puremagic.com says...
>
>I have been toying with D to bring myself up to speed and I found myself writing
>a lot of unit tests, always a good thing.  In those unit tests I found myself
>writing a lot of blocks like:
>
>if (cond)
>{
>writefln("some debugging output to make my life easier");
>assert(false);
>}
>
>I know many don't like unit tests to have output, but I do.  To simplify this,
>I've created a patch for gdc/dmd to allow this syntax instead:
>
>assert(cond, "some optional debugging output to make my life easier");
>
>http://www.puremagic.com/~braddr/d/assert-optional-message-0.1.diff
>http://www.puremagic.com/~braddr/d/assert-test.d
>
>I've run this through dstress with no regressions.
>
>Anyone wanna give it a whirl?
>
>Later,
>Brad

I was just about to start bringing this patch up to work with current dmd and
gdc but decided I should ask first:

Is anyone using it with gdc 0.17?
Would anyone use it if I freshened it up?
Walter, would you be interested / willing to incorporate the parser part into
dmd and support the feature in dmd?

I've seen a couple alternatives suggested, but they've all been somewhat hacky,
imho.

Later,
Brad





More information about the Digitalmars-d mailing list