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;