Skip to content

Commit

Permalink
Add testcase for late metaclass reinitialisation losing methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
rafl committed Sep 20, 2009
1 parent cf88df8 commit fc9ee14
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions t/late_reinitialize.t
@@ -0,0 +1,35 @@
use strict;
use warnings;
use Test::More;

{
package Foo;
use Moose::Role;
sub role_method {}
}

{
package BaseClass;
use Moose;
BEGIN { extends 'MooseX::MethodAttributes::Inheritable' }
}

{
package Bar;
use Moose;
BEGIN { ::ok(!Bar->meta->has_method('role_method')) }
BEGIN { ::ok(!Bar->can('role_method')) }
BEGIN { extends 'BaseClass'; with 'Foo' }
BEGIN { ::ok( Bar->meta->has_method('role_method')) }
BEGIN { ::ok( Bar->can('role_method')) }
use namespace::autoclean;
BEGIN { ::ok( Bar->meta->has_method('role_method')) }
BEGIN { ::ok( Bar->can('role_method')) }
sub foo : Bar {}
BEGIN { ::ok( Bar->meta->has_method('role_method')) }
BEGIN { ::ok( Bar->can('role_method')) }
::ok( Bar->meta->has_method('role_method'));
::ok( Bar->can('role_method'));
}

done_testing;

0 comments on commit fc9ee14

Please sign in to comment.