Skip to content

Commit

Permalink
No longer allow strings with dies_ok/lives_ok
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Aug 15, 2014
1 parent 1378792 commit dd8679e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Test.pm
Expand Up @@ -206,22 +206,22 @@ multi sub isa_ok(Mu $var, Mu $type, $msg = ("The object is-a '" ~ $type.perl ~ "
return $ok;
}

multi sub dies_ok($code, $reason = '') is export {
multi sub dies_ok(Callable $code, $reason = '') is export {
$time_after = nqp::p6box_n(nqp::time_n);
my $death = 1;
try {
$code ~~ Callable ?? $code() !! EVAL $code;
$code();
$death = 0;
}
my $ok = proclaim( $death, $reason );
$time_before = nqp::p6box_n(nqp::time_n);
return $ok;
}

multi sub lives_ok($code, $reason = '') is export {
multi sub lives_ok(Callable $code, $reason = '') is export {
$time_after = nqp::p6box_n(nqp::time_n);
try {
$code ~~ Callable ?? $code() !! EVAL $code;
$code();
}
my $ok = proclaim((not defined $!), $reason) or diag($!);
$time_before = nqp::p6box_n(nqp::time_n);
Expand Down

0 comments on commit dd8679e

Please sign in to comment.