factor codegen stuff out to Eval::Closure
[gitmo/Class-MOP.git] / t / 310_inline_structor.t
index 88aa7ad..04732d2 100644 (file)
@@ -3,11 +3,9 @@ use warnings;
 
 use Test::More;
 
-BEGIN {
-    eval "use Test::Output;";
-    plan skip_all => "Test::Output is required for this test" if $@;
-    plan tests => 15;
-}
+use Test::Requires {
+    'Test::Output' => '0.01', # skip all if not installed
+};
 
 use Class::MOP;
 
@@ -202,8 +200,7 @@ use Class::MOP;
     sub _inline_destructor {
         my $self = shift;
 
-        my ( $code, $e ) = $self->_eval_closure( {}, 'sub { }' );
-        die $e if $e;
+        my $code = $self->_compile_code(source => 'sub { }');
 
         $self->{body} = $code;
     }
@@ -293,3 +290,5 @@ use Class::MOP;
         'got a warning when trying to inline a destructor in a class that inherits an unexpected DESTROY'
     );
 }
+
+done_testing;