Commit | Line | Data |
ec1fb2f4 |
1 | #!/usr/bin/env perl |
2 | use strict; |
3 | use warnings; |
4 | use Test::More tests => 2; |
5 | |
6 | do { |
7 | package MyRole; |
8 | use MooseX::Role::Parameterized; |
9 | |
10 | parameter attribute => ( |
11 | is => 'ro', |
12 | isa => 'Str', |
13 | ); |
14 | |
15 | sub meth { 1 } |
16 | |
17 | role { |
18 | my $p = shift; |
19 | |
20 | has $p->attribute => ( |
21 | is => 'ro', |
22 | ); |
23 | }; |
24 | }; |
25 | |
26 | do { |
27 | package MyClass; |
28 | use Moose; |
29 | with 'MyRole' => { |
30 | attribute => 'attr', |
31 | }; |
32 | }; |
33 | |
34 | ok(MyClass->can('attr'), "the parameterized attribute was composed"); |
35 | ok(MyClass->can('meth'), "the unparameterized method was composed"); |
36 | |