Mouse::Util::does_role() respects $thing->does() method
[gitmo/Mouse.git] / t / 050_metaclasses / 017_use_base_of_moose.t
1 #!/usr/bin/env perl
2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
5
6 use strict;
7 use warnings;
8
9 use Test::More;
10 use Test::Exception;
11
12 {
13     package NoOpTrait;
14     use Mouse::Role;
15 }
16
17 {
18     package Parent;
19     use Mouse -traits => 'NoOpTrait';
20
21     has attr => (
22         is  => 'rw',
23         isa => 'Str',
24     );
25 }
26
27 {
28     package Child;
29     use base 'Parent';
30 }
31
32 is(Child->meta->name, 'Child', "correct metaclass name");
33
34 my $child = Child->new(attr => "ibute");
35 ok($child, "constructor works");
36
37 is($child->attr, "ibute", "getter inherited properly");
38
39 $child->attr("ition");
40 is($child->attr, "ition", "setter inherited properly");
41
42 done_testing;