File: 014-compose-parameterizable.t

package info (click to toggle)
libmoosex-role-parameterized-perl 1.11-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 464 kB
  • sloc: perl: 439; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 560 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use strict;
use warnings;
use Test::More 0.88;

do {
    package MyRole;
    use MooseX::Role::Parameterized;

    parameter attribute => (
        isa => 'Str',
    );

    sub meth { 1 }

    role {
        my $p = shift;

        has $p->attribute => (
            is => 'ro',
        );
    };
};

do {
    package MyClass;
    use Moose;
    with 'MyRole' => {
        attribute => 'attr',
    };
};

ok(MyClass->can('attr'), "the parameterized attribute was composed");
ok(MyClass->can('meth'), "the unparameterized method was composed");

done_testing;