Skip to content

Commit

Permalink
[Test.pm] (eval_)dies_ok should not accept "Null PMC access"
Browse files Browse the repository at this point in the history
Use diag() to report Null PMC access failures of dies_ok

Signed-off-by: moritz <moritz@faui2k3.org>
  • Loading branch information
Kyle Hasselbacher authored and moritz committed Jul 19, 2009
1 parent d99b5b8 commit f9d6284
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Test.pm
Expand Up @@ -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, '');
Expand All @@ -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, '');
Expand Down

0 comments on commit f9d6284

Please sign in to comment.