Commit | Line | Data |
587d7a00 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
5 | use Test::Fatal; |
6 | |
7 | { |
8 | package X; |
9 | |
10 | use Moose; |
11 | |
12 | ::like( |
13 | ::exception{ has foo => ( |
14 | is => 'ro', |
15 | isa => 'Foo', |
16 | handles => qr/.*/, |
17 | ) |
18 | }, |
19 | qr/\QThe foo attribute is trying to delegate to a class which has not been loaded - Foo/, |
20 | 'cannot delegate to a class which is not yet loaded' |
21 | ); |
22 | |
23 | ::like( |
24 | ::exception{ has foo => ( |
25 | is => 'ro', |
26 | does => 'Role::Foo', |
27 | handles => qr/.*/, |
28 | ) |
29 | }, |
30 | qr/\QThe foo attribute is trying to delegate to a role which has not been loaded - Role::Foo/, |
31 | 'cannot delegate to a role which is not yet loaded' |
32 | ); |
33 | } |
34 | |
35 | done_testing; |