From: Shawn M Moore Date: Sun, 9 Nov 2008 03:02:52 +0000 (+0000) Subject: Tests X-Git-Tag: 0.05~108 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=31fb288b6470670ed9798ac456458df002f3d7e5;p=gitmo%2FMooseX-Role-Parameterized.git Tests --- diff --git a/t/001-parameters.t b/t/001-parameters.t index ba3ba57..33ce86a 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 => 2; +use Test::More tests => 5; use Test::Exception; use MooseX::Role::Parameterized::Parameters; @@ -14,6 +14,24 @@ do { use MooseX::Role::Parameterized; }; -my $parameter_class = MyRole::NoParameters->meta->parameter_class; -ok($parameter_class); +my $parameter_metaclass = MyRole::NoParameters->meta->parameter_metaclass; +is($parameter_metaclass->get_all_attributes, 0, "no parameters"); + +do { + package MyRole::LengthParameter; + use MooseX::Role::Parameterized; + + parameter length => ( + is => 'ro', + isa => 'Int', + required => 1, + ); +}; + +$parameter_metaclass = MyRole::LengthParameter->meta->parameter_metaclass; +is($parameter_metaclass->get_all_attributes, 1, "exactly one parameter"); + +my $parameter = ($parameter_metaclass->get_all_attributes)[0]; +is($parameter->name, 'length', "parameter name"); +ok($parameter->is_required, "parameter is required");