From: Arthur Axel 'fREW' Schmidt Date: Wed, 4 Apr 2012 23:45:04 +0000 (-0500) Subject: test for "does" on attrs X-Git-Tag: v0.009_015~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bb8566e487a84a2fb35269f77ea01e96acf04d9d;p=gitmo%2FMoo.git test for "does" on attrs --- diff --git a/xt/moose-does-moo-role.t b/xt/moose-does-moo-role.t new file mode 100644 index 0000000..2e84eb6 --- /dev/null +++ b/xt/moose-does-moo-role.t @@ -0,0 +1,48 @@ +use strictures 1; +use Test::More; +use Test::Exception; + +use Moo::HandleMoose; + +{ + package MooRole; + use Moo::Role; + + package MooRoledMooClass; + use Moo; + with 'MooRole'; + + package MooRoledMooseClass; + use Moose; + with 'MooRole'; + + package MooseParent; + use Moose; + + has e => ( + is => 'ro', + required => 1, + does => 'MooRole', + ); + + package MooParent; + use Moo; + + has e => ( + is => 'ro', + required => 1, + does => 'MooRole', + ); +} + +for my $parent (qw(MooseParent MooParent)) { + for my $child (qw(MooRoledMooClass MooRoledMooseClass)) { + lives_ok { + $parent->new( + e => $child->new(), + ); + } "$parent instantiated with a $child delegate that does a MooRole"; + } +} + +done_testing;