the repository now lives at https://github.com/moose/MooseX-ClassAttributes
[gitmo/MooseX-ClassAttribute.git] / t / 10-strict-role-composition.t
CommitLineData
24820a42 1# Reported as https://rt.cpan.org/Public/Bug/Display.html?id=59663
2
3use strict;
4use warnings;
5
4b757b92 6use Test::More;
24820a42 7use Test::Fatal;
8
9use Test::Requires {
10 'MooseX::Role::Strict' => 0.01,
11};
12
13{
14 package Role;
15
16 use MooseX::Role::Strict;
17 use MooseX::ClassAttribute;
18
19 class_has attr => (
6e861251 20 traits => ['Hash'],
24820a42 21 is => 'ro',
22 isa => 'HashRef[Str]',
23 lazy => 1,
24 default => sub { {} },
24820a42 25 handles => {
26 has_attr => 'exists',
27 },
28 );
29
30 sub normal_method {
31 Test::More::pass('a regular method from the role is composed');
32 }
33
34}
35
36{
37 package Foo;
38 use Moose;
39
40 with 'Role';
41}
42
24820a42 43Foo->normal_method();
44
7f485243 45{
46 local $TODO = 'This test does not yet pass';
24820a42 47
7f485243 48 is(
49 exception { Foo->has_attr('key') }, undef,
50 'Delegated method from native attribute trait is properly composed from a strict role'
51 );
52}
4b757b92 53
54done_testing();