Add TODO test for RT#80492
[gitmo/Moo.git] / t / accessor-roles.t
CommitLineData
c69190f1 1use strictures 1;
2use Test::More;
3use Sub::Quote;
4
5{
6 package One; use Moo;
7 has one => (is => 'ro', default => sub { 'one' });
8
9 package One::P1; use Moo::Role;
10 has two => (is => 'ro', default => sub { 'two' });
11
12 package One::P2; use Moo::Role;
13 has three => (is => 'ro', default => sub { 'three' });
14}
15
16my $combined = Moo::Role->create_class_with_roles('One', qw(One::P1 One::P2));
17isa_ok $combined, "One";
18ok $combined->does($_), "Does $_" for qw(One::P1 One::P2);
19
20my $c = $combined->new;
21is $c->one, "one", "attr default set from class";
22is $c->two, "two", "attr default set from role";
23is $c->three, "three", "attr default set from role";
24
25done_testing;