From: Dave Rolsky Date: Sun, 3 Apr 2011 16:10:49 +0000 (-0500) Subject: More role composition tests X-Git-Tag: v0.25~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=56a8f20e0fb722749bf37ba9c3f83ae24d765edb;p=gitmo%2FMooseX-ClassAttribute.git More role composition tests --- 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();