From: Rafael Kitover Date: Thu, 5 Aug 2010 03:48:27 +0000 (-0400) Subject: rewrite parameterized role test to not use string eval X-Git-Tag: v0.18~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1403ec92341bd56c388d646adc38ff07435dc12d;p=gitmo%2FMooseX-ClassAttribute.git rewrite parameterized role test to not use string eval --- diff --git a/t/07-parameterized-role.t b/t/07-parameterized-role.t index 393b802..656f8fc 100644 --- a/t/07-parameterized-role.t +++ b/t/07-parameterized-role.t @@ -8,18 +8,29 @@ BEGIN { } } -eval <<'EOF'; +{ package Role; use MooseX::Role::Parameterized; use MooseX::ClassAttribute; - role {}; + + parameter foo => (is => 'rw'); + + role { + my $p = shift; + + class_has $p => (is => 'rw'); + }; package Class; use Moose; - with 'Role'; -EOF + with 'Role' => { foo => 'foo' }; +} + +ok((my $instance = Class->new), 'instance'); -ok((not $@), 'used MooseX::ClassAttribute in MooseX::Role::Parameterized role'); -diag $@ if $@; +lives_and { + $instance->foo('bar'); + is $instance->foo, 'bar'; +} 'used class attribute from parameterized role'; done_testing;