File: role_method_conflict_detection.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 (41 lines) | stat: -rw-r--r-- 875 bytes parent folder | download | duplicates (3)
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
36
37
38
39
40
41
use strict;
use warnings;
{
    package RoleOne;
    use MooseX::MethodAttributes::Role;

    sub foo {}
}
{
    package RoleTwo;
    use MooseX::MethodAttributes::Role;

    sub foo {}
}
{
    package RoleThree;
    use MooseX::MethodAttributes::Role;

    sub foo : Action {}
}
{
    package RoleFour;
    use MooseX::MethodAttributes::Role;

    sub foo : ActionRole {}
}
{
    package MyClass;
    use Moose;
    use Test::More tests => 3;
    use Test::Fatal;

    like exception { with qw/RoleOne RoleTwo/; }, qr/method name conflict/,
        'Normal methods conflict detected';

    like exception { with qw/RoleThree RoleFour/; }, qr/method name conflict/,
        'Attributed methods conflict detected';

    like exception { with qw/RoleOne RoleFour/; }, qr/method name conflict/,
        'Attributed and non attributed methods combination - conflict detected';
}