From: Shawn M Moore Date: Sun, 9 Nov 2008 04:33:28 +0000 (+0000) Subject: More tests to make sure we keep the same parameter metaclass X-Git-Tag: 0.05~103 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=095cfb3def8ae3161ee70fd730fffd82078c0008;p=gitmo%2FMooseX-Role-Parameterized.git More tests to make sure we keep the same parameter metaclass --- diff --git a/t/001-parameters.t b/t/001-parameters.t index 4d21551..a5ca29f 100644 --- a/t/001-parameters.t +++ b/t/001-parameters.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 7; +use Test::More tests => 10; use Test::Exception; use MooseX::Role::Parameterized::Parameters; @@ -44,3 +44,21 @@ $p = MyRole::LengthParameter->meta->construct_parameters( ); is($p->length, 5, "correct length"); + +do { + package MyRole::LengthParameter; + use MooseX::Role::Parameterized; + + parameter name => ( + is => 'rw', + isa => 'Str', + ); +}; + +$parameter_metaclass = MyRole::LengthParameter->meta->parameter_metaclass; +is($parameter_metaclass->get_all_attributes, 2, "two parameters"); + +my $name_param = $parameter_metaclass->get_attribute('name'); +is($name_param->type_constraint, 'Str', 'parameter type constraint'); +ok(!$name_param->is_required, 'name is optional'); +