On 1/31/07, Adrian Howard <[EMAIL PROTECTED]> wrote:

On 30 Jan 2007, at 20:11, Joshua ben Jore wrote:

> Interestingly, this has caused me to wonder how well Test::Exception
> handles the corner cases where $@ is clobbered during the scope ending
> of eval{} and related.

It doesn't. It's been on my list for some time, but I'm too lazy :-)

> I've just filed a bug against it at
> http://rt.cpan.org/Ticket/Display.html?id=24678. The overall moral is
> when using eval{} you have to test the return value as well as [EMAIL 
PROTECTED] $@
> can be empty under errors which is kind of a bummer.

My problem with making T::E do the "right" thing (for certain
definitions of right) is that it may not help folk - since the edge
case behaviour is something that the majority of people never
encounter so while the test will "work" their code won't.

Well... what I was hoping was that by making T::E exceptionally picky
that undetected errors would become visible. Right now you can have
some code that runs in T::E which says it passed but maybe it didn't
really and we just didn't notice. If T::E begins taking notice of
these corner cases then they also get promoted to a level that the
user is aware of.

I want to get to the world where these corner cases have enough bright
lights on them so they're fixed or at least compensated for. Then
there's the *next* set of corner cases ... If T::E doesn't change to
try to catch them then I see no change in the world and the corner
case continues to go undiagnosed.

   dies_ok { $o->annoying_corner_case } 'exception thrown';

do the SIG{__DIE__} dance make the tester write

   dies_ok { $o->annoying_corner_case; 1 } 'exception thrown';

If the SIG{__DIE__} dance happens entirely in T::E (as I suggested in
my patch) then the user's tests do not require any change. I thought
it'd be good to test all three things: that eval returned something
other than undef, that $@ is empty, and SIG{__DIE__} wasn't called.

Josh

Reply via email to