From: John Napiorkowski Date: Tue, 19 May 2009 03:24:15 +0000 (-0400) Subject: more fixes to the tests X-Git-Tag: 0.01~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1e87d1a705363a4b403c08438227017faad0df5f;p=gitmo%2FMooseX-Dependent.git more fixes to the tests --- diff --git a/lib/MooseX/Dependent/Meta/TypeConstraint/Dependent.pm b/lib/MooseX/Dependent/Meta/TypeConstraint/Dependent.pm index ab439b6..43851c6 100644 --- a/lib/MooseX/Dependent/Meta/TypeConstraint/Dependent.pm +++ b/lib/MooseX/Dependent/Meta/TypeConstraint/Dependent.pm @@ -210,7 +210,7 @@ sub __infer_constraint_generator { hook into compile_type_constraint so we can set the correct validation rules. -=cut + around 'compile_type_constraint' => sub { my ($compile_type_constraint, $self) = @_; @@ -297,4 +297,5 @@ it under the same terms as Perl itself. =cut -__PACKAGE__->meta->make_immutable; +__PACKAGE__->meta->make_immutable(inline_constructor => 0); + diff --git a/t/01-dependent.t b/t/01-dependent.t index 78fbb38..a202843 100644 --- a/t/01-dependent.t +++ b/t/01-dependent.t @@ -1,5 +1,5 @@ -use Test::More tests=>2; { +use Test::More tests=>5; { use strict; use warnings; @@ -8,8 +8,27 @@ use Test::More tests=>2; { use MooseX::Types -declare=>[qw(SubDependent)]; use Moose::Util::TypeConstraints; - ## Raw tests on dependent. - ok subtype( SubDependent, as Dependent ), 'Create a useless subtype'; - ok ((Dependent->check(1)), 'Dependent is basically an Any'); - + ok subtype( SubDependent, as Dependent ), + 'Create a useless subtype'; + ok Dependent->check(1), + 'Dependent is basically an Any'; + ok SubDependent->check(1), + 'SubDependent is basically an Any'; + is Dependent->parent, 'Any', + 'Dependent is an Any'; + is SubDependent->parent, 'MooseX::Dependent::Types::Dependent', + 'SubDependent is a Dependent'; + is Dependent->get_message, "Validation failed for 'MooseX::Dependent::Types::Dependent' failed with value undef", + 'Got Expected Message' + warn SubDependent->get_message; } + +__END__ + +check +validate +get_message +name +equals +is_a_type_of +is_subtype_of \ No newline at end of file