Karen Etheridge > Test-Deep-Type-0.004 > Test::Deep::Type

Download:
Test-Deep-Type-0.004.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.004   Source   Latest Release: Test-Deep-Type-0.006

NAME ^

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

VERSION ^

version 0.004

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 ^

Test::Deep::Type 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 ^

CAVEATS ^

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

SUPPORT ^

Bugs may be submitted through https://rt.cpan.org/Public/Dist/Display.html?Name=Test-Deep-Type. I am also usually active on irc, as 'ether' at irc://irc.perl.org.

SEE ALSO ^

Test::Deep

Test::TypeConstraints

Test::Type

MooseX::Types

Moose::Meta::TypeConstraint

Moo

Type::Tiny

AUTHOR ^

Karen Etheridge <ether@cpan.org>

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: