X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F020_attributes%2F021_method_generation_rules.t;h=646e572236a43e189f65a449112b331c833765c2;hb=3968746e3249ebba86ee9caa5bc1cf423fba24bd;hp=d0fbe0b462de23ba63d7db9e043e2813e96f8c02;hpb=7ff5653479c2bfc0794635f7fbade9bfe7bb2381;p=gitmo%2FMoose.git diff --git a/t/020_attributes/021_method_generation_rules.t b/t/020_attributes/021_method_generation_rules.t index d0fbe0b..646e572 100644 --- a/t/020_attributes/021_method_generation_rules.t +++ b/t/020_attributes/021_method_generation_rules.t @@ -3,11 +3,10 @@ use strict; use warnings; -use Test::More tests => 17; +use Test::More; use Test::Exception; - =pod is => rw, writer => _foo # turns into (reader => foo, writer => _foo) @@ -18,11 +17,11 @@ use Test::Exception; =cut sub make_class { - my ($is, $attr, $class) = @_; + my ($is, $attr, $class) = @_; - eval "package $class; use Moose; has 'foo' => ( is => '$is', $attr => '_foo' );"; + eval "package $class; use Moose; has 'foo' => ( is => '$is', $attr => '_foo' );"; - return $@ ? die $@ : $class; + return $@ ? die $@ : $class; } my $obj; @@ -37,7 +36,7 @@ can_ok($obj, qw/foo _foo/); lives_ok {$obj->_foo(1)} "$class->_foo is writer"; is($obj->foo(), 1, "$class->foo is reader"); dies_ok {$obj->foo(2)} "$class->foo is not writer"; # this should fail -ok(!defined $obj->_foo(), "$class->_foo is not reader"); +ok(!defined $obj->_foo(), "$class->_foo is not reader"); $class = make_class('ro', 'writer', 'Test::Class::WriterRO'); ok($class, "Can define attr with ro + writer"); @@ -61,3 +60,4 @@ is($obj->_foo(), 1, "$class->foo is reader"); dies_ok { make_class('ro', 'accessor', "Test::Class::AccessorRO"); } "Cant define attr with ro + accessor"; +done_testing;