6 use Test::More tests => 18;
11 use_ok('Class::MOP::Method');
14 my $method = Class::MOP::Method->wrap(sub { 1 });
15 is($method->meta, Class::MOP::Method->meta, '... instance and class both lead to the same meta');
17 is($method->package_name, 'main', '... our package is main::');
18 is($method->name, '__ANON__', '... our sub name is __ANON__');
20 my $meta = Class::MOP::Method->meta;
21 isa_ok($meta, 'Class::MOP::Class');
23 foreach my $method_name (qw(
28 ok($meta->has_method($method_name), '... Class::MOP::Method->has_method(' . $method_name . ')');
29 my $method = $meta->get_method($method_name);
30 is($method->package_name, 'Class::MOP::Method', '... our package is Class::MOP::Method');
31 is($method->name, $method_name, '... our sub name is "' . $method_name . '"');
35 Class::MOP::Method->wrap()
36 } '... bad args for &wrap';
39 Class::MOP::Method->wrap('Fail')
40 } '... bad args for &wrap';
43 Class::MOP::Method->wrap([])
44 } '... bad args for &wrap';