X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F003_methods.t;h=9dfcb9e15a9dedc8dbba3853144c3167643ca239;hb=e0e4674a7071c8b072752ac5d4e450f778cb8766;hp=4d46a6895b5212fa4fc917aeb1043a6e8fa39a8b;hpb=7855ddba257d675899620452f97912ccf69efb77;p=gitmo%2FClass-MOP.git diff --git a/t/003_methods.t b/t/003_methods.t index 4d46a68..9dfcb9e 100644 --- a/t/003_methods.t +++ b/t/003_methods.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 64; +use Test::More tests => 66; use Test::Exception; use Scalar::Util qw/reftype/; @@ -21,6 +21,9 @@ BEGIN { # import a sub use Scalar::Util 'blessed'; + sub pie; + sub cake (); + use constant FOO_CONSTANT => 'Foo-CONSTANT'; # define a sub in package @@ -56,6 +59,9 @@ BEGIN { my $Foo = Class::MOP::Class->initialize('Foo'); +ok(!$Foo->has_method('pie'), '... got the method stub pie'); +ok(!$Foo->has_method('cake'), '... got the constant method stub cake'); + my $foo = sub { 'Foo::foo' }; ok(!UNIVERSAL::isa($foo, 'Class::MOP::Method'), '... our method is not yet blessed'); @@ -95,7 +101,7 @@ ok(!$OinkyBoinky->has_method('bar'), "the method 'bar' is not defined in OinkyBo ok(my $bar = $OinkyBoinky->find_method_by_name('bar'), "but if you look in the inheritence chain then 'bar' does exist"); -is( reftype($bar), "CODE", "the returned value is a code ref" ); +is( reftype($bar->body), "CODE", "the returned value is a code ref" ); # calling get_method blessed them all @@ -110,7 +116,7 @@ for my $method_name (qw/FOO_CONSTANT isa_ok($Foo->get_method($method_name), 'Class::MOP::Method'); { no strict 'refs'; - is($Foo->get_method($method_name)->body, \&{'Foo::' . $method_name}, '... body matches CODE ref in package'); + is($Foo->get_method($method_name)->body, \&{'Foo::' . $method_name}, '... body matches CODE ref in package for ' . $method_name); } }