2 # Reported in https://rt.cpan.org/Public/Bug/Display.html?id=59572
7 use Test::More tests => 4;
21 use MooseX::ClassAttribute;
24 is => 'ro', isa => 'HashRef[Str]',
26 default => sub { {} },
33 has foo => ( is => 'rw' );
37 Test::More::pass('a regular method from the role is composed');
43 use strict; use warnings;
45 with 'Role1', 'Role2';
50 local $TODO = 'Class attributes are lost during role composition';
51 # this runs, so Role2 did get composed...
53 ok(Foo->can('foo'), 'Standard attribute applied ok');
55 # Except the delegated method ended up in the wrong place!
57 # ..and MX::Class never got applied properly!
58 ok(Moose::Util::does_role(Foo->meta, 'MooseX::ClassAttribute::Trait::Class'),
59 'metaclass gets MX:CA metaclass trait');
61 # in Moose 1.08/MooseX::ClassAttribute 0.16, this dies with:
62 # Can't locate object method "has_attr" via package "Foo"
63 lives_ok { Foo->has_attr('key') }
64 'Delegated method from native attribute trait is properly composed from a role composed in a list of roles';