From: Shawn M Moore Date: Wed, 26 Nov 2008 02:02:48 +0000 (+0000) Subject: Make sure we properly blow away the anon role's symbol table X-Git-Tag: 0.62~11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=941d8c3220bcf5dd33409c9eb4ccd4c1ce250179;p=gitmo%2FMoose.git Make sure we properly blow away the anon role's symbol table --- diff --git a/t/030_roles/036_free_anonymous_roles.t b/t/030_roles/036_free_anonymous_roles.t index c243655..f0197d9 100644 --- a/t/030_roles/036_free_anonymous_roles.t +++ b/t/030_roles/036_free_anonymous_roles.t @@ -1,26 +1,34 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 2; +use Test::More tests => 4; use Moose (); use Scalar::Util 'weaken'; my $weak; +my $name; do { my $anon_class; do { - my $role = Moose::Meta::Role->create_anon_role; + my $role = Moose::Meta::Role->create_anon_role( + methods => { + improperly_freed => sub { 1 }, + }, + ); weaken($weak = $role); + $name = $role->name; + $anon_class = Moose::Meta::Class->create_anon_class( roles => [ $role->name ], ); }; ok($weak, "we still have the role metaclass because the anonymous class that consumed it is still alive"); - + ok($name->can('improperly_freed'), "we have not blown away the role's symbol table"); }; ok(!$weak, "the role metaclass is freed after its last reference (from a consuming anonymous class) is freed"); +ok(!$name->can('improperly_freed'), "we blew away the role's symbol table entries");