[dmd-internals] assert inside unittest sucks

Steve Schveighoffer schveiguy at yahoo.com
Mon Jun 28 04:19:01 PDT 2010


I thought this was the way it worked!  It needs to work this way, because often times, further parts of the same unit test depend on the prior parts passing.

I assumed that assert was still throwing, and being caught outside the unit test.  Something like this would be fine:

unittest
{
   x = new X;
   assert(x);
   x.foo();
}

translates to:

unittest
{
   try
   {
       x = new X;
       assert(x);
       x.foo();
   }
   catch(AssertionError e)
   {
       printAssertion(e);
   }
}

-Steve



----- Original Message ----
> From: Andrei Alexandrescu <andrei at erdani.com>
> If you do want to improve 
> things, please have assert abort the current unittest and continue to the next 
> one. The current semantics is 
> unbearable.


      


More information about the dmd-internals mailing list