Commit | Line | Data |
4b9d4666 |
1 | #!/usr/bin/env perl |
2 | use strict; |
3 | use warnings; |
4 | use Test::More; |
b10dde3a |
5 | use Test::Fatal; |
4b9d4666 |
6 | |
7 | BEGIN { |
8 | { |
9 | package Foo; |
10 | use Moose::Role; |
11 | } |
12 | |
13 | { |
14 | package Bar::Class; |
15 | use Moose::Role; |
16 | } |
17 | |
18 | { |
19 | package Bar::ToClass; |
20 | use Moose::Role; |
21 | |
22 | after apply => sub { |
23 | my $self = shift; |
24 | my ($role, $class) = @_; |
25 | Moose::Util::MetaRole::apply_metaroles( |
26 | for => $class, |
27 | class_metaroles => { |
28 | class => ['Bar::Class'], |
29 | } |
30 | ); |
31 | }; |
32 | } |
33 | |
34 | { |
35 | package Bar; |
36 | use Moose::Role; |
37 | Moose::Util::MetaRole::apply_metaroles( |
38 | for => __PACKAGE__, |
39 | role_metaroles => { |
40 | application_to_class => ['Bar::ToClass'], |
41 | } |
42 | ); |
43 | } |
44 | } |
45 | |
46 | { |
47 | package Parent; |
48 | use Moose -traits => 'Foo'; |
49 | } |
50 | |
51 | { |
52 | package Child; |
53 | use Moose -traits => 'Bar'; |
b10dde3a |
54 | ::is( ::exception { extends 'Parent' }, undef ); |
4b9d4666 |
55 | } |
56 | |
57 | done_testing; |