Allow metaclasses to be reinitialized from an existing metaclass, instead of only...
[gitmo/Class-MOP.git] / t / 312_anon_class_leak.t
1 use strict;
2 use warnings;
3
4 use Class::MOP;
5 use Test::More;
6
7 BEGIN {
8     eval "use Test::LeakTrace;";
9     plan skip_all => "Test::LeakTrace is required for this test" if $@;
10 }
11
12 plan tests => 2;
13
14 # 5.10.0 has a bug on weaken($hash_ref) which leaks an AV.
15 my $expected = ( $] == 5.010_000 ? 1 : 0 );
16
17 leaks_cmp_ok {
18     Class::MOP::Class->create_anon_class();
19 }
20 '<=', $expected, 'create_anon_class()';
21
22 leaks_cmp_ok {
23     Class::MOP::Class->create_anon_class( superclasses => [qw(Exporter)] );
24 }
25 '<=', $expected, 'create_anon_class(superclass => [...])';
26