[phobos] Silent failure of std.container unittests

Jason Spencer spencer8 at sbcglobal.net
Fri Jul 16 09:21:15 PDT 2010


I think this is the right line to pursue.  The user can select the behavior of a 
failure then.


----- Original Message ----
> From: Leandro Lucarella <luca at llucax.com.ar>
> To: phobos at puremagic.com
> Sent: Fri, July 16, 2010 6:31:05 AM
> Subject: Re: [phobos] Silent failure of std.container unittests
> 
> Andrei Alexandrescu, el 15 de julio a las 18:55 me escribiste:
> > On  07/15/2010 06:00 PM, Sean Kelly wrote:
> > >On Jul 15, 2010, at 3:43 PM,  Andrei Alexandrescu wrote:
> > >>
> > >>I think there's a  disadvantage there. FWIW changing the semantics
> > >>of assert that  way will translate into a disincentive to use it
> > >>inside  unittests ("Hmm, I better use enforce() here because
> > >>assert() is  just weird.")
> > >
> > >Is there a disadvantage in providing a  separate routine that reports
> > >and doesn't throw?  I know it's  another global symbol (assuming it's
> > >in object.di), but...
> > 
> > Good question. expect() comes to mind.
> 
> I prefer check(), and  boost users will feel at home :)
> 
> warn() can be nice to have too, but I  think they should not be global.
> std.test comes to mind.
> 
> See  [1]:
> 
> Level   Test log content                        Errors           Test
>                                                  counter        execution
> ======================================================================
> WARN     warning in <test case name>:            not affected  continues
>         condition  <assertion description>
>         is not  satisfied
> ----------------------------------------------------------------------
> CHECK    error in <test case name>: test         increased     continues
>         <assertion  description>  failed
> ----------------------------------------------------------------------
> REQUIRE  fatal error in <test case name>:       increased      aborts
>         critical test <assertion  description>
>         failed
> 
> (replace require  with assert... well, and add the counter =P)
> 
> 
> [1]  
>http://www.boost.org/doc/libs/1_42_0/libs/test/doc/html/utf/testing-tools.html
>      More helper functions for unit tests:
>      
>http://www.boost.org/doc/libs/1_42_0/libs/test/doc/html/utf/testing-tools/reference.html
>
> 
> -- 
> Leandro Lucarella (AKA luca)                       http://llucax.com.ar/
> ----------------------------------------------------------------------
> GPG  Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A  8D05)
> ----------------------------------------------------------------------
> they  wrap me up in the back of the trunk
> packed with foam and blind drunk
> they  won't ever take me alive
> cause they all drive killer  cars
> _______________________________________________
> phobos mailing  list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
> 


More information about the phobos mailing list