Implement strict constructors, which will warn unkown constructor arguments
[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
16 {
17     package Parent;
18     use Mouse "-traits" => 'NoOpTrait';
19
20     has attr => (
21         is  => 'rw',
22         isa => 'Str',
23     );
24 }
25
26 {
27     package Child;
28     use base 'Parent';
29 }
30 is(Child->meta->name, 'Child', "correct metaclass name");
31 my $child = Child->new(attr => "ibute");
32 ok($child, "constructor works");
33
34
35 is($child->attr, "ibute", "getter inherited properly");
36
37 $child->attr("ition");
38 is($child->attr, "ition", "setter inherited properly");