Apply the parameterizable role to the parameterized role 8)
[gitmo/MooseX-Role-Parameterized.git] / t / 014-compose-parameterizable.t
CommitLineData
ec1fb2f4 1#!/usr/bin/env perl
2use strict;
3use warnings;
4use Test::More tests => 2;
5
6do {
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
26do {
27 package MyClass;
28 use Moose;
29 with 'MyRole' => {
30 attribute => 'attr',
31 };
32};
33
34ok(MyClass->can('attr'), "the parameterized attribute was composed");
35ok(MyClass->can('meth'), "the unparameterized method was composed");
36