merged with delegation_bugs branch
[gitmo/MooseX-ClassAttribute.git] / t / 11-strict-role-composition.t
CommitLineData
a9d2b1a7 1
2# Reported as https://rt.cpan.org/Public/Bug/Display.html?id=59663
3
4package main;
5use Test::More tests => 3;
6use Test::Exception;
7
8use Test::Requires {
9 'MooseX::Role::Strict' => 0.01, # skip all if not installed
10};
11
12{
13 package Role;
14
15 use MooseX::Role::Strict;
16 use MooseX::ClassAttribute;
17
18 class_has attr => (
19 is => 'ro', isa => 'HashRef[Str]',
20 lazy => 1,
21 default => sub { {} },
22 traits => ['Hash'],
23 handles => {
24 has_attr => 'exists',
25 },
26 );
27
28
29 sub normal_method
30 {
31 Test::More::pass('a regular method from the role is composed');
32 }
33
34}
35
36{
37 package Foo;
38 use strict; use warnings;
39 use Moose;
40 with 'Role';
41}
42
43package main;
44use Test::NoWarnings;
45
46Foo->normal_method;
47
48lives_ok { Foo->has_attr('key') }
49 'Delegated method from native attribute trait is properly composed from a strict role';
50
51