From: Graham Knop Date: Wed, 19 Jun 2013 02:48:57 +0000 (-0400) Subject: test for consuming multiple Moose roles X-Git-Tag: v1.003000~43 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f7f5e02d968e5b0ed7800dcca37bb4955b9a11ab;p=gitmo%2FMoo.git test for consuming multiple Moose roles --- diff --git a/xt/moo-consume-moose-role-multiple.t b/xt/moo-consume-moose-role-multiple.t new file mode 100644 index 0000000..3e8a75c --- /dev/null +++ b/xt/moo-consume-moose-role-multiple.t @@ -0,0 +1,30 @@ +use strictures 1; +use Test::More; + +{ + package RoleOne; + use Moose::Role; + + has foo => ( is => 'rw' ); +} + +{ + package RoleTwo; + use Moose::Role; + + has bar => ( is => 'rw' ); +} + +{ + package SomeClass; + use Moo; + + with 'RoleOne', 'RoleTwo'; +} + +my $i = SomeClass->new( foo => 'bar', bar => 'baz' ); +is $i->foo, 'bar', "attribute from first role is correct"; +is $i->bar, 'baz', "attribute from second role is correct"; + +done_testing; +