Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement eval_dies_ok, eval_lives_ok
  • Loading branch information
sorear committed Mar 1, 2011
1 parent a7846ce commit 980923f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/Test.pm6
Expand Up @@ -79,12 +79,6 @@ sub ok(\$bool, $tag?) is export { $*TEST-BUILDER.ok(?$bool, $tag) }
sub nok(\$bool, $tag?) is export { $*TEST-BUILDER.ok(!$bool, $tag) }
sub pass($tag?) is export { $*TEST-BUILDER.ok(1, $tag) }
sub flunk($tag?) is export { $*TEST-BUILDER.ok(0, $tag) }
sub eval_dies_ok($, $tag?) is export {
$*TEST-BUILDER.todo($tag, "eval");
}
sub eval_lives_ok($, $tag?) is export {
$*TEST-BUILDER.todo($tag, "eval");
}
sub isa_ok($obj, $type, $tag?) is export { $*TEST-BUILDER.ok($obj.^isa($type), $tag) }
sub is($got, $expected, $tag?) is export {

Expand All @@ -109,6 +103,16 @@ sub dies_ok($code,$why?) is export {
try { $code.(); $lived = True; }
$*TEST-BUILDER.ok(!$lived, $why);
}
sub eval_dies_ok($code, $why?) is export {
my $lived = False;
try { eval $code; $lived = True; }
$*TEST-BUILDER.ok(!$lived, $why);
}
sub eval_lives_ok($code, $why?) is export {
my $lived = False;
try { eval $code; $lived = True; }
$*TEST-BUILDER.ok($lived, $why);
}
sub plan($num) is export { $*TEST-BUILDER.plan($num) }
sub done() is export { $*TEST-BUILDER.done }
sub skip($number,$reason) is export {
Expand Down

0 comments on commit 980923f

Please sign in to comment.