Require Dist::Zilla 4.200016+
[gitmo/Moose.git] / t / attributes / delegation_target_not_loaded.t
CommitLineData
587d7a00 1use strict;
2use warnings;
3
4use Test::More;
5use 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
35done_testing;