From: Moritz Onken Date: Thu, 20 Jan 2011 13:32:59 +0000 (+0100) Subject: failing test for composite roles and application metaclasses X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3ed3394481e86a04d56a15fa1161f035240ef320;p=gitmo%2FMoose.git failing test for composite roles and application metaclasses --- diff --git a/t/030_roles/027_role_composition_meta.t b/t/030_roles/027_role_composition_meta.t new file mode 100644 index 0000000..3891bce --- /dev/null +++ b/t/030_roles/027_role_composition_meta.t @@ -0,0 +1,72 @@ +#!/usr/bin/perl +use strict; +use warnings; + +use Test::More; +use Moose::Exporter; + +my $attributes_applied = 0; + +{ + + package MyMoose; + use Moose; + + Moose::Exporter->setup_import_methods( + role_metaroles => { + application_to_class => + ['Application'], + }, ); + + package Application; + use Moose::Role; + + before apply_attributes => sub { + $attributes_applied++; + }; + + package RoleA; + use Moose::Role; + MyMoose->import; + + + + has bar => ( is => 'rw', default => 1 ); + + package RoleB; + use Moose::Role; + MyMoose->import; + + has foo => ( is => 'rw', default => 1 ); +} + +{ + + package ComposeList; + + use Moose; + use namespace::autoclean; + + with qw( RoleB RoleA ); + + __PACKAGE__->meta->make_immutable; +} + +is($attributes_applied, 2); + +{ + + package ComposeSeparate; + + use Moose; + use namespace::autoclean; + + with 'RoleA'; + with 'RoleB'; + + __PACKAGE__->meta->make_immutable; +} + +is($attributes_applied, 4); + +done_testing;