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 => ( |
ec1fb2f4 |
11 | isa => 'Str', |
12 | ); |
13 | |
14 | sub meth { 1 } |
15 | |
16 | role { |
17 | my $p = shift; |
18 | |
19 | has $p->attribute => ( |
20 | is => 'ro', |
21 | ); |
22 | }; |
23 | }; |
24 | |
25 | do { |
26 | package MyClass; |
27 | use Moose; |
28 | with 'MyRole' => { |
29 | attribute => 'attr', |
30 | }; |
31 | }; |
32 | |
33 | ok(MyClass->can('attr'), "the parameterized attribute was composed"); |
34 | ok(MyClass->can('meth'), "the unparameterized method was composed"); |
35 | |