X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F08-role-composition.t;h=1e8d0bb345953396be7383472e5be5b6654c4787;hb=21828519c45dcd8599aebd99a21c1e462d8c2f61;hp=279e542d206beb43f8ca1e115a452473bae131e4;hpb=5a7bfdcc18e2b8cade087b9c3b28c20ebfcc230a;p=gitmo%2FMooseX-ClassAttribute.git diff --git a/t/08-role-composition.t b/t/08-role-composition.t index 279e542..1e8d0bb 100644 --- a/t/08-role-composition.t +++ b/t/08-role-composition.t @@ -51,4 +51,57 @@ ok( 'Class attributes are preserved when role is applied to another role' ); +{ + package Role4; + use Moose::Role; + + use MooseX::ClassAttribute; + + class_has 'CA2' => ( + is => 'ro', + isa => 'HashRef', + default => sub { {} }, + ); +} + +{ + package Buz; + use Moose; + + with 'Role', 'Role4'; +} + +ok( + Buz->can('CA'), + 'Class attributes are merged from two roles (CA)' +); + +ok( + Buz->can('CA2'), + 'Class attributes are merged from two roles (CA2)' +); + +{ + package Role5; + use Moose::Role; + with 'Role', 'Role4'; +} + +{ + package Quux; + use Moose; + + with 'Role5'; +} + +ok( + Quux->can('CA'), + 'Class attributes are merged from two roles (CA)' +); + +ok( + Quux->can('CA2'), + 'Class attributes are merged from two roles (CA2)' +); + done_testing();