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