Provided by: libtest-deep-type-perl_0.008-2_all bug

NAME

       Test::Deep::Type - A Test::Deep plugin for validating type constraints

VERSION

       version 0.008

SYNOPSIS

           use Test::More;
           use Test::Deep;
           use Test::Deep::Type;
           use MooseX::Types::Moose 'Str';

           cmp_deeply(
               {
                   message => 'ack I am slain',
                   counter => 123,
               },
               {
                   message => is_type(Str),
                   counter => is_type(sub { die "not an integer" unless int($_[0]) eq $_[0] }),
               },
               'message is a plain string, counter is a number',
           );

DESCRIPTION

       This is a Test::Deep plugin that provides the sub "is_type" to indicate that the data
       being tested must validate against the passed type. This is an actual type object, not a
       string name -- for example something provided via MooseX::Types, or a plain old coderef
       that returns a bool (such as what might be used in a Moo type constraint).

FUNCTIONS

   "is_type"
       Exported by default; to be used within a Test::Deep comparison function such as
       cmp_deeply.  As this module aims to be a solution for many popular type systems, we
       attempt to use the type in multiple ways:

       MooseX::Types/Moose::Meta::TypeConstraint-style types:
           If the "validate" method exists, it is invoked on the type object with the data as its
           parameter (which should return "undef" on success, and the error message on failure).

       coderef/Moo-style types:
           If the type appears to be or act like a coderef (either a coderef, blessed or
           unblessed, or possesses a coderef overload) the type is invoked as a sub, with the
           data as its parameter. Its return value is treated as a boolean; if it also dies with
           a message describing the failure, this message is used in the failure diagnostics.

           Type::Tiny types fall into this category, and are fully supported.

CAVEATS

       Regular strings describing a type under a particular system (e.g. Moose, Params::Validate)
       are not currently supported.

SEE ALSO

       •   Test::Deep

       •   Test::TypeConstraints

       •   Test::Type

       •   Test::Deep::Matcher

       •   MooseX::Types

       •   Moose::Meta::TypeConstraint

       •   Moo

       •   Type::Tiny

SUPPORT

       Bugs may be submitted through the RT bug tracker
       <https://rt.cpan.org/Public/Dist/Display.html?Name=Test-Deep-Type> (or
       bug-Test-Deep-Type@rt.cpan.org <mailto:bug-Test-Deep-Type@rt.cpan.org>).

       There is also a mailing list available for users of this distribution, at
       <http://lists.perl.org/list/perl-qa.html>.

       There is also an irc channel available for users of this distribution, at "#perl" on
       "irc.perl.org" <irc://irc.perl.org/#perl-qa>.

       I am also usually active on irc, as 'ether' at "irc.perl.org".

AUTHOR

       Karen Etheridge <ether@cpan.org>

CONTRIBUTOR

       Graham Knop <haarg@haarg.org>

COPYRIGHT AND LICENCE

       This software is copyright (c) 2013 by Karen Etheridge.

       This is free software; you can redistribute it and/or modify it under the same terms as
       the Perl 5 programming language system itself.