From: Dave Rolsky Date: Tue, 26 Oct 2010 20:19:30 +0000 (-0500) Subject: Tidy code and remove unneeded module loads X-Git-Tag: 1.18~54 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4acaa12eea4d2dadc3b1e5d6eac8f08edb54bef6;p=gitmo%2FMoose.git Tidy code and remove unneeded module loads --- diff --git a/t/100_bugs/029_lazy_build_inherited.t b/t/100_bugs/029_lazy_build_inherited.t index 8027675..35919e5 100644 --- a/t/100_bugs/029_lazy_build_inherited.t +++ b/t/100_bugs/029_lazy_build_inherited.t @@ -1,11 +1,10 @@ use strict; use warnings; -use Test::More tests => 12; -use Test::Exception; -use Test::NoWarnings; +use Test::More; { + package Parent; use Moose; has attr => ( is => 'rw', isa => 'Str' ); @@ -17,37 +16,60 @@ use Test::NoWarnings; extends 'Parent'; has '+attr' => ( lazy_build => 1 ); - sub _build_attr - { + + sub _build_attr { return 'value'; } } -package main; - my $parent = Parent->new(); -my $child = Child->new(); - -ok(!$parent->meta->get_attribute('attr')->is_lazy_build, - 'attribute in parent does not have lazy_build trait'); -ok(!$parent->meta->get_attribute('attr')->is_lazy, - 'attribute in parent does not have lazy trait'); -ok(!$parent->meta->get_attribute('attr')->has_builder, - 'attribute in parent does not have a builder method'); -ok(!$parent->meta->get_attribute('attr')->has_clearer, - 'attribute in parent does not have a clearer method'); -ok(!$parent->meta->get_attribute('attr')->has_predicate, - 'attribute in parent does not have a predicate method'); - -ok($child->meta->get_attribute('attr')->is_lazy_build, - 'attribute in child has the lazy_build trait'); -ok($child->meta->get_attribute('attr')->is_lazy, - 'attribute in child has the lazy trait'); -ok($child->meta->get_attribute('attr')->has_builder, - 'attribute in child has a builder method'); -ok($child->meta->get_attribute('attr')->has_clearer, - 'attribute in child has a clearer method'); -ok($child->meta->get_attribute('attr')->has_predicate, - 'attribute in child has a predicate method'); - -is($child->attr, 'value', 'attribute defined as lazy_build in child is properly built'); +my $child = Child->new(); + +ok( + !$parent->meta->get_attribute('attr')->is_lazy_build, + 'attribute in parent does not have lazy_build trait' +); +ok( + !$parent->meta->get_attribute('attr')->is_lazy, + 'attribute in parent does not have lazy trait' +); +ok( + !$parent->meta->get_attribute('attr')->has_builder, + 'attribute in parent does not have a builder method' +); +ok( + !$parent->meta->get_attribute('attr')->has_clearer, + 'attribute in parent does not have a clearer method' +); +ok( + !$parent->meta->get_attribute('attr')->has_predicate, + 'attribute in parent does not have a predicate method' +); + +ok( + $child->meta->get_attribute('attr')->is_lazy_build, + 'attribute in child has the lazy_build trait' +); +ok( + $child->meta->get_attribute('attr')->is_lazy, + 'attribute in child has the lazy trait' +); +ok( + $child->meta->get_attribute('attr')->has_builder, + 'attribute in child has a builder method' +); +ok( + $child->meta->get_attribute('attr')->has_clearer, + 'attribute in child has a clearer method' +); +ok( + $child->meta->get_attribute('attr')->has_predicate, + 'attribute in child has a predicate method' +); + +is( + $child->attr, 'value', + 'attribute defined as lazy_build in child is properly built' +); + +done_testing;