New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Test.pm consider "Null PMC access" an invalid death in dies_ok #1144
Comments
From @kylehaSometimes something dies, as it should, but with the wrong error. The Kyle. |
From @kyleha0001--Test.pm-dies_ok-should-not-be-ok-when-death-is-fro.patchFrom 8eb6fc78316e686bec5749b6e3baae1b86d56375 Mon Sep 17 00:00:00 2001
From: Kyle Hasselbacher <kyle@livetext.com>
Date: Wed, 15 Jul 2009 12:40:05 -0500
Subject: [PATCH] [Test.pm] dies_ok should not be ok when death is from "Null PMC access"
[Test.pm] eval_dies_ok should also not accept "Null PMC access"
---
Test.pm | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Test.pm b/Test.pm
index 0f90a16..3770d73 100644
--- a/Test.pm
+++ b/Test.pm
@@ -123,7 +123,7 @@ multi sub dies_ok(Callable $closure, $reason) is export(:DEFAULT) {
try {
$closure();
}
- proclaim((defined $!), $reason);
+ proclaim((defined $! && "$!" !~~ / ^ 'Null PMC access ' /), $reason);
}
multi sub dies_ok(Callable $closure) is export(:DEFAULT) {
dies_ok($closure, '');
@@ -140,7 +140,8 @@ multi sub lives_ok(Callable $closure) is export(:DEFAULT) {
}
multi sub eval_dies_ok(Str $code, $reason) is export(:DEFAULT) {
- proclaim((defined eval_exception($code)), $reason);
+ my $ee = eval_exception($code);
+ proclaim((defined $ee && "$ee" !~~ / ^ 'Null PMC access' /), $reason);
}
multi sub eval_dies_ok(Str $code) is export(:DEFAULT) {
eval_dies_ok($code, '');
--
1.6.0.4
|
From @moritzKyle Hasselbacher (via RT) wrote:
I like the idea very much, but the current implementation is a bit Cheers, |
The RT System itself - Status changed from 'new' to 'open' |
From @kylehaOn Thu, Jul 16, 2009 at 4:30 PM, Moritz Lenz via
Here's a new patch. Now a failure looks like this (example from # wrong way to die: 'Null PMC access in invoke()' |
From @kyleha0001--Test.pm-dies_ok-should-not-be-ok-when-death-is-fro.patchFrom c7aa28fa2dc31d48f805a66b0cff38386a3d6273 Mon Sep 17 00:00:00 2001
From: Kyle Hasselbacher <kyle@livetext.com>
Date: Wed, 15 Jul 2009 12:40:05 -0500
Subject: [PATCH] [Test.pm] dies_ok should not be ok when death is from "Null PMC access"
[Test.pm] eval_dies_ok should also not accept "Null PMC access"
[Test.pm] use diag() to report Null PMC access failures of dies_ok
---
Test.pm | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/Test.pm b/Test.pm
index 0f90a16..72517d0 100644
--- a/Test.pm
+++ b/Test.pm
@@ -123,7 +123,10 @@ multi sub dies_ok(Callable $closure, $reason) is export(:DEFAULT) {
try {
$closure();
}
- proclaim((defined $!), $reason);
+ if "$!" ~~ / ^ 'Null PMC access ' / {
+ diag "wrong way to die: '$!'";
+ }
+ proclaim((defined $! && "$!" !~~ / ^ 'Null PMC access ' /), $reason);
}
multi sub dies_ok(Callable $closure) is export(:DEFAULT) {
dies_ok($closure, '');
@@ -140,7 +143,11 @@ multi sub lives_ok(Callable $closure) is export(:DEFAULT) {
}
multi sub eval_dies_ok(Str $code, $reason) is export(:DEFAULT) {
- proclaim((defined eval_exception($code)), $reason);
+ my $ee = eval_exception($code);
+ if "$ee" ~~ / ^ 'Null PMC access ' / {
+ diag "wrong way to die: '$ee'";
+ }
+ proclaim((defined $ee && "$ee" !~~ / ^ 'Null PMC access' /), $reason);
}
multi sub eval_dies_ok(Str $code) is export(:DEFAULT) {
eval_dies_ok($code, '');
--
1.6.0.4
|
From @moritzOn Thu Jul 16 21:00:50 2009, KyleHa wrote:
Thanks for the new patch, that behaviour looks much better. I'll test it Cheers, |
From @moritzOn Thu Jul 16 21:00:50 2009, KyleHa wrote:
Thanks, applied. |
@moritz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#67622 (status was 'resolved')
Searchable as RT67622$
The text was updated successfully, but these errors were encountered: