6 use Test::More tests => 6;
9 my $test1 = Mouse::Meta::Class->create_anon_class;
10 $test1->add_method( 'foo1', sub { } );
12 my $t1 = $test1->new_object;
13 my $t1_am = $t1->meta->get_method('foo1')->associated_metaclass;
15 ok( $t1_am, 'associated_metaclass is defined' );
18 $t1_am, 'Mouse::Meta::Class',
19 'associated_metaclass is correct class'
22 like( $t1_am->name(), qr/::__ANON__::/,
23 'associated_metaclass->name looks like an anonymous class' );
34 my $t2_am = $t2->meta->get_method('foo2')->associated_metaclass;
36 ok( $t2_am, 'associated_metaclass is defined' );
39 $t2_am, 'Mouse::Meta::Class',
40 'associated_metaclass is correct class'
43 is( $t2_am->name(), 'Test2',
44 'associated_metaclass->name is Test2' );