Skip Alien-Ditaa
[gitmo/Moose.git] / t / metaclasses / use_base_of_moose.t
1 #!/usr/bin/env perl
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7
8 {
9     package NoOpTrait;
10     use Moose::Role;
11 }
12
13 {
14     package Parent;
15     use Moose -traits => 'NoOpTrait';
16
17     has attr => (
18         is  => 'rw',
19         isa => 'Str',
20     );
21 }
22
23 {
24     package Child;
25     use base 'Parent';
26 }
27
28 is(Child->meta->name, 'Child', "correct metaclass name");
29
30 my $child = Child->new(attr => "ibute");
31 ok($child, "constructor works");
32
33 is($child->attr, "ibute", "getter inherited properly");
34
35 $child->attr("ition");
36 is($child->attr, "ition", "setter inherited properly");
37
38 done_testing;