also allow suppressing the meta method during CMOP::Class->create
[gitmo/Class-MOP.git] / t / 312_anon_class_leak.t
index 14ac2d3..750c584 100644 (file)
@@ -4,12 +4,9 @@ use warnings;
 use Class::MOP;
 use Test::More;
 
-BEGIN {
-    eval "use Test::LeakTrace;";
-    plan skip_all => "Test::LeakTrace is required for this test" if $@;
-}
-
-plan tests => 2;
+use Test::Requires {
+    'Test::LeakTrace' => '0.01', # skip all if not installed
+};
 
 # 5.10.0 has a bug on weaken($hash_ref) which leaks an AV.
 my $expected = ( $] == 5.010_000 ? 1 : 0 );
@@ -24,3 +21,4 @@ leaks_cmp_ok {
 }
 '<=', $expected, 'create_anon_class(superclass => [...])';
 
+done_testing;