Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Exception CPAN distribution.

Report information
The Basics
Id: 49617
Status: resolved
Priority: 0/
Queue: Test-Exception

People
Owner: Nobody in particular
Requestors: ANDK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.27
Fixed in: 0.29



Subject: Bleadperl breaks Test-Exception-0.27
Tests of Test::Exception started to fail recently. The test results sometimes look like this: # Failed test 'regex in stacktrace ignored' # at t/stacktrace.t line 17. # STDOUT is: # ok 1 - threw /fribble/ # # not: # not ok 1 - threw /fribble/ # # as expected # STDERR is: # # not: # /#\s+Failed\ test.*?\n?.*?at\ t\/stacktrace\.t line 13.*\n?/ # # # expecting: /fribble/ # # # found: died at t/stacktrace.t line 13 # # # main::__ANON__() called at /home/src/perl/repoperls/installed-perls/perl /GitLive-blead-1583-gba7a454/lib/site_perl/5.11.0/Sub/Uplevel.pm line 133 # # # Sub::Uplevel::uplevel(3, 'CODE(0x11642d8)') called at /home/sand/.cpan/b uild/Test-Exception-0.27-GCZp5h/blib/lib/Test/Exception.pm line 104 # # # eval {...} called at /home/sand/.cpan/build/Test-Exception-0.27-GCZp5h/b lib/lib/Test/Exception.pm line 104 # # # Test::Exception::_try_as_caller('CODE(0x11642d8)') called at /home/sand/ .cpan/build/Test-Exception-0.27-GCZp5h/blib/lib/Test/Exception.pm line 178 # # # Test::Exception::throws_ok('CODE(0x11642d8)', '/fribble/') called at t/s tacktrace.t line 13 # # as expected t/stacktrace.t .. Failed 1/2 subtests I can reproduce this with all bleadperls starting with commit ba7a45496628db970f8607e67b4345e8bc45f6fe Author: Rafael Garcia-Suarez <rgarciasuarez@gmail.com> Date: Tue Jul 14 09:16:17 2009 +0200 Merge Carp::Heavy into Carp HTH && Regards,
Now perlbugged as #70161
blead Carp uses caller() so Sub::Uplevel must always be loaded first to put the global override in place. Patch attached. -- David
From 24b52ff9542c56a7de8ac82a3eb600e21a73ec73 Mon Sep 17 00:00:00 2001 From: David Golden <dagolden@cpan.org> Date: Wed, 4 Nov 2009 17:04:55 -0500 Subject: [PATCH] blead Carp uses caller(); must load Sub::Uplevel first --- lib/Test/Exception.pm | 7 ++++--- t/stacktrace.t | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Test/Exception.pm b/lib/Test/Exception.pm index c5a077e..ae45dc2 100644 --- a/lib/Test/Exception.pm +++ b/lib/Test/Exception.pm @@ -6,7 +6,6 @@ use Test::Builder; use Sub::Uplevel qw( uplevel ); use base qw( Exporter ); use Scalar::Util 'blessed'; -use Carp; our $VERSION = '0.27_04'; our @EXPORT = qw(dies_ok lives_ok throws_ok lives_and); @@ -209,8 +208,10 @@ test description is passed. sub throws_ok (&$;$) { my ( $coderef, $expecting, $description ) = @_; - croak "throws_ok: must pass exception class/object or regex" - unless defined $expecting; + unless (defined $expecting) { + require Carp; + Carp::croak( "throws_ok: must pass exception class/object or regex" ); + } $description = _exception_as_string( "threw", $expecting ) unless defined $description;
Since David's patch got truncated I've uploaded a variant of it to CPAN: ANDK/patches/Test-Exception-0.27-DAGOLDEN-01.patch.gz A distroprefs snippet is on the github repo: http://github.com/andk/cpanpm/blob/47b13dc8a7ec3f2d787adf8a2b2a8039f3e74a4a/distroprefs/ADIE.Test-Exception.yml