File: not-both.t

package info (click to toggle)
libmoo-perl 2.005005-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 840 kB
  • sloc: perl: 2,506; makefile: 2
file content (47 lines) | stat: -rw-r--r-- 813 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use strict;
use warnings;
use lib 't/lib';

use Test::More;
use CaptureException;

use Moo ();
use Moo::Role ();

{
  like exception {
    package ZZZ;
    Role::Tiny->import;
    Moo->import;
  }, qr{Cannot import Moo into a role},
    "can't import Moo into a Role::Tiny role";
}

{
  like exception {
    package XXX;
    Moo->import;
    Moo::Role->import;
  }, qr{Cannot import Moo::Role into a Moo class},
    "can't import Moo::Role into a Moo class";
}

{
  like exception {
    package YYY;
    Moo::Role->import;
    Moo->import;
  }, qr{Cannot import Moo into a role},
    "can't import Moo into a Moo role";
}

{
  is exception {
    package FFF;
    $Moo::MAKERS{+__PACKAGE__} = {};
    Moo::Role->import;
  }, undef,
    "Moo::Role can be imported into a package with fake MAKERS";
}

done_testing;