Skip Menu |

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

Report information
The Basics
Id: 75430
Status: resolved
Priority: 0/
Queue: Test-Trap

People
Owner: ebhanssen [...] allverden.no
Requestors: felliott [...] virginia.edu
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: v0.2.1
Fixed in: (no value)



Subject: Failing tests in 06-layer.t
Hello, When trying to install Test::Trap v0.2.1 on my system (OS X 10.6, perl 5.14.2), the "internal exceptions caught and rethrown" tests in 06-layers.t fail because the given and expected error message differ by a trailing period. However, the same tests pass on 5.10.1 and 5.12.4. Attached is a patch that makes these tests pass on 5.10, 5.12, and 5.14. I wasn't able to test it on 5.8 or earlier. The patch replaces the die_is with a die_like, removes the final "\n" from $expected, and escapes the meta chars in $expected. Thank you for your work on this module! Cheers, Fitz Elliott uname -a: Darwin catsby 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 perl -v: This is perl 5, version 14, subversion 2 (v5.14.2) built for darwin-2level
Subject: Test-Trap-06-layers.t.patch
--- 1330463554.4583/Test-Trap-v0.2.1/t/06-layers.t 2009-12-29 17:16:06.000000000 -0500 +++ ../latest-build/Test-Trap-v0.2.1/t/06-layers.t 2012-02-29 12:40:24.000000000 -0500 @@ -80,14 +80,14 @@ for my $case ( [ exception1 => sub { die "going down\n" }, - "Rethrowing internal exception: going down\n at (exception1) line 7\n", + "Rethrowing internal exception: going down\n at (exception1) line 7", 0, '(in layer, so user code not run)', ], [ exception2 => sub { my $self = shift; $self->Teardown(sub { die "going up\n" } ); $self->Next }, join( $/, "Rethrowing teardown exception: going up\n", "Rethrowing teardown exception: going up", - " at (exception2) line 7\n", + " at (exception2) line 7", ), 1, '(in teardown, so user code has been run)', ], @@ -95,7 +95,7 @@ join( $/, "Rethrowing internal exception: going down\n", "Rethrowing teardown exception: going up", - " at (exception3) line 7\n", + " at (exception3) line 7", ), 0, '(in layer, so user code has not run)', ], @@ -111,7 +111,7 @@ $trap->quiet(' ... quietly'); } trap { %s { ++$x } }; - $trap->die_is( $exception, ' ... internal exceptions caught and rethrown' ); + $trap->die_like( qr/\Q$exception\E/, ' ... internal exceptions caught and rethrown' ); is( $x, $value, ' ... in %s, so user code %s' ); $trap->quiet; 1;
Subject: Re: [rt.cpan.org #75430] Failing tests in 06-layer.t
Date: Thu, 1 Mar 2012 16:26:36 +0000
To: bug-Test-Trap [...] rt.cpan.org
From: Zefram <zefram [...] fysh.org>
The trailing period is a change in Carp-1.25, to make it properly match Perl's builtin "die". It's independent of Perl version, except by way of the Perl core bundling Carp. Perl 5.15.8 bundles Carp-1.25, which has the dot, and all earlier Perls bundle earlier versions of Carp, which don't have the dot. -zefram
Thank you. I intend to test that no additional stuff ends up in the exception message, so I have rewritten the exact matches more thoroughly as regexen. I'll need to dig up some old perls and test with, but if that works out, I'll make a release within hours.
I have made the new release, and my tests with 5.6.2, 5.8.7, 5.10.1, and 5.15.8 all pass, so I assume this is fixed.