3 use Test::More tests => 8;
9 package Arbitrary::Roll;
13 my $method_meta = Moose::Meta::Class->create_anon_class(
14 superclasses => ['Moose::Meta::Method'],
15 roles => ['Arbitrary::Roll'],
18 # For comparing identity without actually keeping $original_meta around
19 my $original_meta = "$method_meta";
21 my $method_class = $method_meta->name;
23 my $method_object = $method_class->wrap(
25 associated_metaclass => Ball->meta,
26 package_name => 'Ball',
30 Ball->meta->add_method(bounce => $method_object);
33 is(Ball->bounce, 'ok', "method still exists on Ball");
34 is(Ball->meta->get_method('bounce')->meta->name, $method_class, "method's package still exists");
36 local $TODO = "method seems to be reinitialized" if !$method_meta;
38 is(Ball->meta->get_method('bounce')->meta . '', $original_meta, "method's metaclass still exists");
39 ok(Ball->meta->get_method('bounce')->meta->does_role('Arbitrary::Roll'), "method still does Arbitrary::Roll");