On Mon Jan 14 05:25:18 2013, SREZIC wrote:
Show quoted text> On 2012-11-29 04:36:22, BJAKUBSKI wrote:
> > Run:
> >
> > perl -MTest::Exception=1 -e 'throws_ok { return 1 } qr/.*/;'
> >
> > to see the problem.
> >
> > We tried to use such construct to detect failures, without knowing
error
Show quoted text> > message beforehand. Using it instead of dies_ok makes it simpler to
fill
Show quoted text> > in actual expected error later (when it becomes known).
> >
> > I do believe that throws_ok should never pass if no exception was
thrown.
Show quoted text>
> Shouldn't the regexp be written to match at least one character, e.g.
> qr/.+/? Otherwise it also matches the empty string...
>
I wanted it to match _always_ if there is exception thrown. I didn't use
dies_ok, cause I knew I'd put specific pattern there later, so I knew
I'll have throws_ok there in the end anyway.
I find it very weird that "no exception thrown" is considered the same
(as far as test goes) as exception that stringifies to empty string
here.
It seems simpler and more logical to me for throws_ok to pass only if:
1. there WAS actual exception (no matter what value it has nor what it
stringifies to)
AND
2. it matches supplied regex/class