From: Shawn M Moore Date: Mon, 14 Sep 2009 04:00:34 +0000 (+0900) Subject: Don't count attributes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a8c3785706f09ff9357bd2e90604efedf60a07e0;p=gitmo%2Fmoose-presentations.git Don't count attributes it causes an unexpected test failure when starting the second exercise --- diff --git a/moose-class/exercises/t/lib/MooseClass/Tests.pm b/moose-class/exercises/t/lib/MooseClass/Tests.pm index 924c5db..d6f07c0 100644 --- a/moose-class/exercises/t/lib/MooseClass/Tests.pm +++ b/moose-class/exercises/t/lib/MooseClass/Tests.pm @@ -7,20 +7,12 @@ use Lingua::EN::Inflect qw( A PL_N ); use Test::More 'no_plan'; sub tests01 { - my %p = ( - person_attr_count => 2, - employee_attr_count => 3, - @_, - ); - local $Test::Builder::Level = $Test::Builder::Level + 1; has_meta('Person'); check_isa( 'Person', ['Moose::Object'] ); - count_attrs( 'Person', $p{person_attr_count} ); - has_rw_attr( 'Person', $_ ) for qw( first_name last_name ); has_method( 'Person', 'full_name' ); @@ -34,8 +26,6 @@ sub tests01 { check_isa( 'Employee', [ 'Person', 'Moose::Object' ] ); - count_attrs( 'Employee', $p{employee_attr_count} ); - has_rw_attr( 'Employee', $_ ) for qw( title salary ); has_ro_attr( 'Employee', 'ssn' ); @@ -45,7 +35,7 @@ sub tests01 { } sub tests02 { - tests01( person_attr_count => 3, @_ ); + tests01(); local $Test::Builder::Level = $Test::Builder::Level + 1; @@ -280,15 +270,6 @@ sub check_isa { } } -sub count_attrs { - my $class = shift; - my $count = shift; - - my $noun = PL_N( 'attribute', $count ); - is( scalar $class->meta->get_attribute_list, $count, - "$class defines $count $noun" ); -} - sub has_rw_attr { my $class = shift; my $name = shift;