File: 043_conflict_many_methods.t

package info (click to toggle)
librole-basic-perl 0.16-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 252 kB
  • sloc: perl: 1,725; makefile: 7
file content (52 lines) | stat: -rw-r--r-- 1,204 bytes parent folder | download | duplicates (6)
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
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/perl
use strict;
use warnings;

use lib 'lib', 't/lib';
use MyTests tests => 3;

{
    package Bomb;
    use Role::Basic;

    sub fuse { }
    sub explode { }

    package Spouse;
    use Role::Basic;

    sub fuse { }
    sub explode { }

    package Caninish;
    use Role::Basic;

    sub bark { }

    package Treeve;
    use Role::Basic;

    sub bark { }
}

{
    package PracticalJoke;
    use Role::Basic 'with';

    my $exception = ::exception { with 'Bomb', 'Spouse' };
    ::like( $exception,
qr/Due to a method name conflict in roles 'Bomb' and 'Spouse', the method 'fuse' must be implemented or excluded by 'PracticalJoke'/
    );

    ::like $exception, qr/Due to a method name conflict in roles 'Bomb' and 'Spouse', the method 'explode' must be implemented or excluded by 'PracticalJoke'/,
        '... and all methods will be listed in the exception';

    package PracticalJoke2;
    use Role::Basic 'with';
    ::like( ::exception {
        with (
            'Bomb', 'Spouse',
            'Caninish', 'Treeve',
        );
    }, qr/Due to a method name conflict in roles 'Caninish' and 'Treeve', the method 'bark' must be implemented or excluded by 'PracticalJoke2'/ );
}