Assert and the optional Message

Jacob Carlborg doob at me.com
Sun Mar 11 05:13:58 PDT 2012


On 2012-03-10 18:08, Jonathan M Davis wrote:

> I honestly don't think that Walter even considered unit testing frameworks
> when he came up with the design. He built unit tests into the language. So,
> from his point of view, why would you need a unit testing framework? He
> probably didn't even consider it.

I don't think he considered unit testing frameworks either.

> And if you really want to do your own unit testing framework, maybe you should
> just create your own custom assertion functions which throw something other
> than AssertError - though if they don't throw Errors, then any unittest blocks
> with a catch(Exception() {} in them may not work properly, so that's not
> necessarily all that great a solution either, depending.
>
> - Jonathan M Davis

Yeah, exactly. And it feels a bit stupid to duplicate the assert 
statement just to throw something that isn't an AssertError.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list