Pelle MÃ¥nsson Wrote:
>
> An assertion handler should be created for use in unittests. Preferably
> with colorized output. :)
>
> I stole and changed slightly from std.contracts.enforce (untested)
>
> T test(T, string file=__FILE__, int line=__LINE__)
> (T value, string message="Test failed") {
> if (!value) writeln(file, "(", line, "): ", message);
> return value;
> }
>
> Use just like an assert, but will just write on errors.
Heh, yeah, if I had just noticed std.contracts in the first place, I would have
realized that I still had __FILE__ and __LINE__ to play around with. Ah well --
D's usual thoughtfulness pulls through again!
And I'm a sucker for bright colors too, so I'm building colorized output into
my set of unit test augmentations. :-)