Removing ddoc and unittest

Janderson ask at me.com
Tue Nov 11 23:17:26 PST 2008


Christopher Wright wrote:
> bearophile wrote:
>> 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.
> 
> It's motivated by the lack of reflection in D1.
> 
> In dunit, you first make a test fixture:
> class FooTests : TestFixture
> {
> }
> 
> Then in the constructor, you define tests:
> class FooTests : TestFixture
> {
>     this ()
>     {
>         tests["test 1"] =
>         {
>             assert (1 < 2);
>         };
>     }
> }
> 
> A filter just goes in between the test name and the test body:
> class FooTests : TestFixture
> {
>     this ()
>     {
>         tests["test 1"] = expectedException!(AssertError) =
>         {
>             assert (!(1 < 2));
>         };
>     }
> }
> 

*sigh* This is smart and all.  However this is the sort of thing that 
puts me off unit tests that are not part of the language (or their own 
language).  It feels like a big hack to me.

-Joel



More information about the Digitalmars-d mailing list