use strict;
use warnings;
-use Test::More tests => 64;
+use Test::More tests => 66;
use Test::Exception;
use Scalar::Util qw/reftype/;
# import a sub
use Scalar::Util 'blessed';
+ sub pie;
+ sub cake ();
+
use constant FOO_CONSTANT => 'Foo-CONSTANT';
# define a sub in package
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');
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
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);
}
}