File: param_role.t

package info (click to toggle)
libmoosex-methodattributes-perl 0.32-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 496 kB
  • sloc: perl: 648; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 535 bytes parent folder | download
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
use strict;
use warnings;

use Test::More 0.88;
use Test::Needs 'MooseX::Role::Parameterized';

package Foo;
use MooseX::Role::Parameterized -traits => 'MooseX::MethodAttributes::Role::Meta::Role';

parameter foo => (
    isa => "Str",
);

role {
    my $p = shift;

    method test_foo => sub {
        my ($self, $should_be) = @_;
        package main;
        is $p->foo, $should_be, 'parameter is correct';
    };
};

package UseFoo;
use Moose;

with Foo => { foo => 23 };

package main;

UseFoo->new->test_foo(23);

done_testing;