Default parameters to read-only
[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 => (
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
25do {
26 package MyClass;
27 use Moose;
28 with 'MyRole' => {
29 attribute => 'attr',
30 };
31};
32
33ok(MyClass->can('attr'), "the parameterized attribute was composed");
34ok(MyClass->can('meth'), "the unparameterized method was composed");
35