2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
9 use Scalar::Util 'weaken';
17 my $role = Mouse::Meta::Role->create_anon_role(
19 improperly_freed => sub { 1 },
22 weaken($weak = $role);
26 $anon_class = Mouse::Meta::Class->create_anon_class(
27 roles => [ $role->name ],
31 ok($weak, "we still have the role metaclass because the anonymous class that consumed it is still alive");
32 ok($name->can('improperly_freed'), "we have not blown away the role's symbol table");
35 ok(!$weak, "the role metaclass is freed after its last reference (from a consuming anonymous class) is freed");
37 ok(!$name->can('improperly_freed'), "we blew away the role's symbol table entries");