Failing test from ether
[gitmo/MooseX-ClassAttribute.git] / t / 11-strict-role-composition.t
1 # Reported as https://rt.cpan.org/Public/Bug/Display.html?id=59663
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 3;
7 use Test::Fatal;
8
9 use 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 => (
20         is      => 'ro',
21         isa     => 'HashRef[Str]',
22         lazy    => 1,
23         default => sub { {} },
24         traits  => ['Hash'],
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
43 use Test::NoWarnings;
44
45 Foo->normal_method();
46
47 is(
48     exception { Foo->has_attr('key') }, undef,
49     'Delegated method from native attribute trait is properly composed from a strict role'
50 );
51