Moose::Meta::Class->get_method_map was both broken and completely
[gitmo/Moose.git] / t / 010_basics / 018_methods.t
CommitLineData
96245b5a 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More tests => 4;
7
8
9my $test1 = Moose::Meta::Class->create_anon_class;
10$test1->add_method( 'foo1', sub { } );
11
12my $t1 = $test1->new_object;
13my $t1_am = $t1->meta->get_method('foo1')->associated_metaclass;
14ok( $t1_am, 'associated_metaclass is defined' );
15isa_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
29my $t2 = Test2->new;
30my $t2_am = $t2->meta->get_method('foo2')->associated_metaclass;
31ok( $t2_am, 'associated_metaclass is defined' );
32
33isa_ok(
34 $t2_am, 'Moose::Meta::Class',
35 'associated_metaclass is correct class'
36);