From: Dave Rolsky Date: Sat, 1 Nov 2008 19:31:52 +0000 (+0000) Subject: Add a few more tests for ->associated_metaclass on methods X-Git-Tag: 0.61~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=19f02ab1ff53c3d05bbc0f4b43769a9af2274c49;p=gitmo%2FMoose.git Add a few more tests for ->associated_metaclass on methods --- diff --git a/t/010_basics/018_methods.t b/t/010_basics/018_methods.t index ce202cc..f9e8511 100644 --- a/t/010_basics/018_methods.t +++ b/t/010_basics/018_methods.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 6; my $test1 = Moose::Meta::Class->create_anon_class; @@ -11,12 +11,17 @@ $test1->add_method( 'foo1', sub { } ); my $t1 = $test1->new_object; my $t1_am = $t1->meta->get_method('foo1')->associated_metaclass; + ok( $t1_am, 'associated_metaclass is defined' ); + isa_ok( $t1_am, 'Moose::Meta::Class', 'associated_metaclass is correct class' ); +like( $t1_am->name(), qr/::__ANON__::/, + 'associated_metaclass->name looks like an anonymous class' ); + { package Test2; @@ -28,9 +33,13 @@ isa_ok( my $t2 = Test2->new; my $t2_am = $t2->meta->get_method('foo2')->associated_metaclass; + ok( $t2_am, 'associated_metaclass is defined' ); isa_ok( $t2_am, 'Moose::Meta::Class', 'associated_metaclass is correct class' ); + +is( $t2_am->name(), 'Test2', + 'associated_metaclass->name is Test2' );