[phobos] Silent failure of std.container unittests

Jonathan M Davis jmdavisprog at gmail.com
Thu Jul 15 17:01:49 PDT 2010


On Thursday, July 15, 2010 16:00:01 Sean Kelly wrote:
> 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...

I can't think of any (though obviously someone else may). And if you name it 
with a name that starts with assert - like assert_nothrow() - then it's not 
terribly likely that it would conflict with a symbol name that someone wanted to 
use in their code anyway. Certainly, it seems like the best solution to me at 
the moment. It allows Walter (and anyone else like him) to have all of his 
assertions fail without stopping the unittest they're in, while assert itself 
functions normally. You get the bost of both worlds. It just means that 
assertions that aren't supposed to throw have to use a different function. I 
don't see any real downside to that solution unless Walter just hates the idea 
of using something other than assert in unittests.

- Jonathan M Davis


More information about the phobos mailing list