Commit | Line | Data |
a9d2b1a7 |
1 | |
2 | # Reported as https://rt.cpan.org/Public/Bug/Display.html?id=59663 |
3 | |
4 | package main; |
5 | use Test::More tests => 3; |
6 | use Test::Exception; |
7 | |
8 | use 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 | |
43 | package main; |
44 | use Test::NoWarnings; |
45 | |
46 | Foo->normal_method; |
47 | |
48 | lives_ok { Foo->has_attr('key') } |
49 | 'Delegated method from native attribute trait is properly composed from a strict role'; |
50 | |
51 | |