X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F11-strict-role-composition.t;fp=t%2F11-strict-role-composition.t;h=cbbadbd3304134b521ac4f77adb82b22f7bdf800;hb=a9d2b1a78f09fa9f0413953fb089ba0918e5da13;hp=0000000000000000000000000000000000000000;hpb=d0f129f508a6f1cc66edd10eb50005c01ca6bee5;p=gitmo%2FMooseX-ClassAttribute.git diff --git a/t/11-strict-role-composition.t b/t/11-strict-role-composition.t new file mode 100644 index 0000000..cbbadbd --- /dev/null +++ b/t/11-strict-role-composition.t @@ -0,0 +1,51 @@ + +# Reported as https://rt.cpan.org/Public/Bug/Display.html?id=59663 + +package main; +use Test::More tests => 3; +use Test::Exception; + +use Test::Requires { + 'MooseX::Role::Strict' => 0.01, # skip all if not installed +}; + +{ + package Role; + + use MooseX::Role::Strict; + use MooseX::ClassAttribute; + + class_has attr => ( + is => 'ro', isa => 'HashRef[Str]', + lazy => 1, + default => sub { {} }, + traits => ['Hash'], + handles => { + has_attr => 'exists', + }, + ); + + + sub normal_method + { + Test::More::pass('a regular method from the role is composed'); + } + +} + +{ + package Foo; + use strict; use warnings; + use Moose; + with 'Role'; +} + +package main; +use Test::NoWarnings; + +Foo->normal_method; + +lives_ok { Foo->has_attr('key') } + 'Delegated method from native attribute trait is properly composed from a strict role'; + +