File: role-conflicts-moox.t

package info (click to toggle)
libmoo-perl 2.004004-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 844 kB
  • sloc: perl: 2,449; makefile: 6
file content (43 lines) | stat: -rw-r--r-- 704 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
use Moo::_strictures;
use Test::More;
use Test::Fatal;

{
  package MooX::ExtendHas;
  BEGIN { $INC{'MooX/ExtendHas.pm'} = __FILE__ }
  use Moo::_Utils qw(_install_modifier);
  sub import {
    my $target = caller;
    _install_modifier $target, 'around', 'has', sub {
      my $orig = shift;
      $orig->(@_);
    };
  }
}

{
  package MyClass;
  use Moo;
}

{
  package MyRole1;
  use Moo::Role;
  use MooX::ExtendHas;

  has foo => (is => "ro");
}

{
  package MyRole2;
  use Moo::Role;
  use MooX::ExtendHas;

  has bar => (is => "ro");
}

is exception {
  Moo::Role->create_class_with_roles('MyClass', qw(MyRole1 MyRole2))
}, undef, "extending has in roles doesn't cause conflicts";

done_testing;