On 31 Dec 2006, at 12:14, Paul LeoNerd Evans wrote:

On Sun, Dec 31, 2006 at 12:45:14PM +0100, A. Pagaltzis wrote:
* David Golden <[EMAIL PROTECTED]> [2006-12-31 11:30]:
Test::Exception depends on Sub::Uplevel, which overrides
CORE::GLOBAL::caller, so there is already some deep magic that
I'm not sure should get rolled into Test::More.

Ouch. OK, I was thinking of the older implementation that was
quite straightforward Perl (though also buggy, according to the
Changelog). So much for that.

It does use Sub::Uplevel but I can't really see why. It seems only used by way of hiding the internal functions from caller(), perhaps to neaten
up error messages or the like...?
[snip]

The problem cases that Sub::UpLevel deals with are where the stringified exceptions include stack traces with arguments (e.g. Carp). For an exception of this type doing something like:

  throws_ok { foo() } qr/Foo/;

would always pass since "qr/Foo/" would appear as an argument to throws_ok() in the first stack frame and match the regex.

I can't see why a simple
implementation inline in the test script (see some of my other mails)
would need to use that, as long as the user was aware of the extra
lines.

Should work fine. dies_ok only uses it for the sake of the common code.

Adrian

Reply via email to