Code tweaklet
[gitmo/MooseX-ClassAttribute.git] / t / 11-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
6use Test::More tests => 3;
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
43use Test::NoWarnings;
44
45Foo->normal_method();
46
47is(
48 exception { Foo->has_attr('key') }, undef,
49 'Delegated method from native attribute trait is properly composed from a strict role'
50);
51