hook into compile_type_constraint so we can set the correct validation rules.
-=cut
+
around 'compile_type_constraint' => sub {
my ($compile_type_constraint, $self) = @_;
=cut
-__PACKAGE__->meta->make_immutable;
+__PACKAGE__->meta->make_immutable(inline_constructor => 0);
+
-use Test::More tests=>2; {
+use Test::More tests=>5; {
use strict;
use warnings;
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