Review: A new stab at a potential std.unittests
Lutger Blijdestijn
lutger.blijdestijn at gmail.com
Sat Nov 20 10:16:55 PST 2010
I'm not particularly fond of this interface and think that a solution with a
delegate / lazy or alias template parameter would be more convenient.
However, until we have ast macros I do see the added value in this approach.
Some remarks about the api, not a proper review of the code itself:
- core.exception and std.string must be imported to use the module, relevant
symbols should be selectively and publicy imported instead.
- exception would be better abbreviated as ex instead of exc, I believe this
is more conventional. (assertExThrown instead of assertExcThrown)
- assertExcThrown should fail if an exception is thrown that is not T or a
subclass of T. (catch and throw AssertError)
- assertEqual and assertNotEqual is inconsistent in naming with the
assertOpFoo class of functions
I believe these assertions should be added:
- assertExcThrown and assertExcNotThrown with a default T (should be
Exception, not Throwable)
- something equivalent to std.algorithm.equal, the latter is very useful in
unittests
- assertOpBinary, assertTrue and perhaps assertPred (where the predicate is
an template alias parameter)
More information about the Digitalmars-d
mailing list