role application works for a simple case
[gitmo/Moo.git] / xt / handle_moose.t
CommitLineData
3362e41c 1use strictures 1;
2
3BEGIN { require "t/moo-accessors.t"; }
4
5use Moo::HandleMoose;
6
7my $meta = Class::MOP::get_metaclass_by_name('Foo');
8
9my $attr;
10
11ok($attr = $meta->get_attribute('one'), 'Meta-attribute exists');
12is($attr->get_read_method, 'one', 'Method name');
13is($attr->get_read_method_ref->body, Foo->can('one'), 'Right method');
14
15is(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
21Moose::Util::apply_all_roles($meta, 'Bar');
22
23my $spoon = Spoon->new(four => 4);
24
25is($spoon->four, 4, 'Role application ok');
26
3362e41c 27done_testing;