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' );
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' );
}
sub tests02 {
- tests01( person_attr_count => 3, @_ );
+ tests01();
local $Test::Builder::Level = $Test::Builder::Level + 1;
}
}
-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;