X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F001_basic.t;fp=t%2F001_basic.t;h=d5f7fc58e89e4dd05a9aa7c9a5b74014bddc7edc;hb=b3cebad5ebbe89eca34b8feeaafd8678417c8b74;hp=fced7191d1da9c0248b781afccafeb0cadf7eee9;hpb=bfacd619d119a4262f60eadcb431fae0cde270a1;p=gitmo%2FMoose-Policy.git diff --git a/t/001_basic.t b/t/001_basic.t index fced719..d5f7fc5 100644 --- a/t/001_basic.t +++ b/t/001_basic.t @@ -6,30 +6,30 @@ use warnings; use Test::More 'no_plan'; BEGIN { - use_ok('Moose::Policy'); + use_ok('Moose::Policy'); } { package My::Moose::Meta::Attribute; use Moose; - + extends 'Moose::Meta::Attribute'; - + # this method (mostly stolen from M::M::Attribute) just rebuilds the # options so anything with 'is' gets PBP accessors sub _process_options { my ($class, $name, $options) = @_; - if (exists $options->{is}) { - if ($options->{is} eq 'ro') { - $options->{reader} = 'get_' . $name; - } - elsif ($options->{is} eq 'rw') { - $options->{reader} = 'get_' . $name; - $options->{writer} = 'set_' . $name; - } - delete $options->{is}; - } - + if (exists $options->{is}) { + if ($options->{is} eq 'ro') { + $options->{reader} = 'get_' . $name; + } + elsif ($options->{is} eq 'rw') { + $options->{reader} = 'get_' . $name; + $options->{writer} = 'set_' . $name; + } + delete $options->{is}; + } + $class->SUPER::_process_options($name, $options); } } @@ -42,10 +42,10 @@ BEGIN { { package Foo; - + use Moose::Policy 'My::Moose::Policy'; use Moose; - + has 'bar' => (is => 'rw', default => 'Foo::bar'); has 'baz' => (is => 'ro', default => 'Foo::baz'); } @@ -66,7 +66,4 @@ can_ok($foo, 'get_baz'); is($foo->get_bar, 'Foo::bar', '... got the right default value'); is($foo->get_baz, 'Foo::baz', '... got the right default value'); - - - - +# vim:ts=4:sw=4:et:sta