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