9076fa81f8ddd5940d955ca8cd48f1a68d0ce788
[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 use Test::More;
6
7 BEGIN{
8     if($] < 5.008){
9         plan skip_all => "segv happens on 5.6.2";
10     }
11 }
12
13 use Test::More tests => 4;
14 use Test::Exception;
15
16 {
17     package NoOpTrait;
18     use Mouse::Role;
19
20
21 }
22
23 {
24     package Parent;
25     use Mouse "-traits" => 'NoOpTrait';
26
27     has attr => (
28         is  => 'rw',
29         isa => 'Str',
30     );
31 }
32
33 {
34     package Child;
35     use base 'Parent';
36 }
37 is(Child->meta->name, 'Child', "correct metaclass name");
38 my $child = Child->new(attr => "ibute");
39 ok($child, "constructor works");
40
41
42 is($child->attr, "ibute", "getter inherited properly");
43
44 $child->attr("ition");
45 is($child->attr, "ition", "setter inherited properly");