convert to Test::Fatal
[gitmo/Eval-Closure.git] / t / 02-close-over.t
index ea6792a..8a58aa3 100644 (file)
@@ -2,6 +2,7 @@
 use strict;
 use warnings;
 use Test::More;
+use Test::Fatal;
 
 use Eval::Closure;
 
@@ -33,16 +34,19 @@ use Test::Requires 'PadWalker';
 }
 
 {
-    local $TODO = "we still have to close over \$__captures";
     my $foo = [];
     my $env = { '$foo' => \$foo };
 
-    my $code = eval_closure(
-        source      => 'sub { push @$foo, @_; return $__captures }',
-        environment => $env,
+    like(
+        exception {
+            eval_closure(
+                source      => 'sub { push @$foo, @_; return $__captures }',
+                environment => $env,
+            );
+        },
+        qr/Global symbol "\$__captures/,
+        "we don't close over \$__captures"
     );
-    is_deeply(scalar(PadWalker::closed_over($code)), $env,
-              "closed over the right things");
 }
 
 # it'd be nice if we could test that closing over other things wasn't possible,