Commit | Line | Data |
3362e41c |
1 | use strictures 1; |
2 | |
3 | BEGIN { require "t/moo-accessors.t"; } |
4 | |
5 | use Moo::HandleMoose; |
6 | |
7 | my $meta = Class::MOP::get_metaclass_by_name('Foo'); |
8 | |
9 | my $attr; |
10 | |
11 | ok($attr = $meta->get_attribute('one'), 'Meta-attribute exists'); |
12 | is($attr->get_read_method, 'one', 'Method name'); |
13 | is($attr->get_read_method_ref->body, Foo->can('one'), 'Right method'); |
14 | |
15 | is(Foo->new(one => 1, THREE => 3)->one, 1, 'Accessor still works'); |
16 | |
7f9775b1 |
17 | $meta = Moose::Meta::Class->initialize('Spoon'); |
18 | |
19 | $meta->superclasses('Moose::Object'); |
20 | |
21 | Moose::Util::apply_all_roles($meta, 'Bar'); |
22 | |
23 | my $spoon = Spoon->new(four => 4); |
24 | |
25 | is($spoon->four, 4, 'Role application ok'); |
26 | |
3362e41c |
27 | done_testing; |