From: Dave Rolsky Date: Tue, 26 Oct 2010 21:11:49 +0000 (-0500) Subject: Add tests for trying to delegate to a class or role which is not yet loaded X-Git-Tag: 1.18~48 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=587d7a00147090ecf637d0b8553d6dcdaa8c9a02;p=gitmo%2FMoose.git Add tests for trying to delegate to a class or role which is not yet loaded --- diff --git a/t/020_attributes/038_delegation_target_not_loaded.t b/t/020_attributes/038_delegation_target_not_loaded.t new file mode 100644 index 0000000..3938786 --- /dev/null +++ b/t/020_attributes/038_delegation_target_not_loaded.t @@ -0,0 +1,35 @@ +use strict; +use warnings; + +use Test::More; +use Test::Fatal; + +{ + package X; + + use Moose; + + ::like( + ::exception{ has foo => ( + is => 'ro', + isa => 'Foo', + handles => qr/.*/, + ) + }, + qr/\QThe foo attribute is trying to delegate to a class which has not been loaded - Foo/, + 'cannot delegate to a class which is not yet loaded' + ); + + ::like( + ::exception{ has foo => ( + is => 'ro', + does => 'Role::Foo', + handles => qr/.*/, + ) + }, + qr/\QThe foo attribute is trying to delegate to a role which has not been loaded - Role::Foo/, + 'cannot delegate to a role which is not yet loaded' + ); +} + +done_testing;