Christopher Wright:

> For what it's worth, dunit supports this:
> tests["no expected exception"] = {};
> tests["fails if it doesn't throw"] = expectedException!(AssertError) = {
> assert(false); };

I don't understand that syntax.


>>4) I'd like to unittest nested functions too.<<
>That's not going to be easy.<

It's not too much important.


>This is interesting. It's not as flexible as dunit or D's unittest blocks -- 
>it'll complain about any user-visible changes to a function. It also looks 
>like it'd be annoying to use, say, mock objects with it. I would have no use 
>for doctests, but I think it's a neat hack.<

I use it every day and I find it very useful, but note it's not meant to 
replace normal unittests (in Python for them you use the unittest module of the 
std lib, or a system you can find online, like "nose"), it's mailing meant to 
write "documentation tests", that is to write normal documentation that also 
contains and shows some usage examples: with doctests you can be sure that 
documentation never goes out of sync with the code, because it's documentation 
that runs.

Bye,
bearophile

Reply via email to