Commit | Line | Data |
96245b5a |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More tests => 4; |
7 | |
8 | |
9 | my $test1 = Moose::Meta::Class->create_anon_class; |
10 | $test1->add_method( 'foo1', sub { } ); |
11 | |
12 | my $t1 = $test1->new_object; |
13 | my $t1_am = $t1->meta->get_method('foo1')->associated_metaclass; |
14 | ok( $t1_am, 'associated_metaclass is defined' ); |
15 | isa_ok( |
16 | $t1_am, 'Moose::Meta::Class', |
17 | 'associated_metaclass is correct class' |
18 | ); |
19 | |
20 | { |
21 | |
22 | package Test2; |
23 | |
24 | use Moose; |
25 | |
26 | sub foo2 { } |
27 | } |
28 | |
29 | my $t2 = Test2->new; |
30 | my $t2_am = $t2->meta->get_method('foo2')->associated_metaclass; |
31 | ok( $t2_am, 'associated_metaclass is defined' ); |
32 | |
33 | isa_ok( |
34 | $t2_am, 'Moose::Meta::Class', |
35 | 'associated_metaclass is correct class' |
36 | ); |