Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Implement eval_dies_ok, eval_lives_ok

  • Loading branch information...
commit 980923f74696b6015ef76c8cf9bf781be0d8d3e4 1 parent a7846ce
@sorear authored
Showing with 10 additions and 6 deletions.
  1. +10 −6 lib/Test.pm6
View
16 lib/Test.pm6
@@ -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 {
@@ -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 {
Please sign in to comment.
Something went wrong with that request. Please try again.