Test::TypeConstraints - testing whether some value is valid as (Moose|Mouse)::Meta::TypeConstraint
use Test::TypeConstraints qw(type_isa); type_isa($got, "ArrayRef[Int]", "type should be ArrayRef[Int]");
Test::TypeConstraints is for testing whether some value is valid as (Moose|Mouse)::Meta::TypeConstraint.
$got is value for checking. $typename_or_type is a Classname or Mouse::Meta::TypeConstraint name or "Mouse::Meta::TypeConstraint" object or "Moose::Meta::TypeConstraint::Class" object. %options is Hash. value is followings:
If true, it will try coercion when checking a value.
If a CodeRef is given, it will be run and passed in the coerced value for additional testing.
type_isa $value, "Some::Class", "coerce to Some::Class", coerce => sub { isa_ok $_[0], "Some::Class"; is $_[0]->value, $value; };
$got is value for checking. $typename_or_type is a Classname or Mouse::Meta::TypeConstraint name or "Mouse::Meta::TypeConstraint" object or "Moose::Meta::TypeConstraint::Role" object. %options is Hash. value is followings:
Same as type_isa's coerce option.
The opposite of type_isa and type_doesnt respectively and takes the same arguments and options. Checks that $got is not of the given type or role.
type_isa
type_doesnt
Keiji Yoshimi <walf443 at gmail dot com>
+<Mouse::Util::TypeConstraints>, +<Moose::Util::TypeConstraints>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Test::TypeConstraints, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::TypeConstraints
CPAN shell
perl -MCPAN -e shell install Test::TypeConstraints
For more information on module installation, please visit the detailed CPAN module installation guide.