std.unittests for (final?) review
Jens Mueller
jens.k.mueller at gmx.de
Wed Jan 5 03:00:46 PST 2011
Lars T. Kyllingstad wrote:
> Sorry for not commenting on earlier iterations of this module. For the
> most part, I think it looks pretty good, and I also think it will be
> useful. Often, I find myself writing stuff like
>
> assert (someVar == someVal,
> text("Wrong value for someVar: ", someVar));
>
> and assertEqual() will be nice to have for those cases. :) I just have
> some minor comments.
>
> 1. I think assertExThrown() and assertExNotThrown() should be named
> assertThrown() and assertNotThrown(), because they can intercept any
> subclass of Throwable, not just Exception, and because you rarely throw
> anything else, so it seems redundant.
I think this is a good renaming. assertThrown and assertNotThrown are
better names.
> 2. I think the name getMsg() is too non-specific. I'd prefer if it was
> renamed to throwableMsg(), thrownMsg(), or something similar. The
> function should also be moved upwards a bit so its documentation follows
> that of the assert*Thrown() functions. Then, the various functions will
> be nicely grouped in the documentation -- all the exception handling
> tests come first, followed by the value tests.
Right. getMsg() is a too general name. Of the given ones I like
thrownMsg() best because it's concise.
Jens
More information about the Digitalmars-d
mailing list