1Test::TypeTiny(3)     User Contributed Perl Documentation    Test::TypeTiny(3)
2
3
4

NAME

6       Test::TypeTiny - useful functions for testing the efficacy of type
7       constraints
8

SYNOPSIS

10          use strict;
11          use warnings;
12          use Test::More;
13          use Test::TypeTiny;
14
15          use Types::Mine qw(Integer Number);
16
17          should_pass(1, Integer);
18          should_pass(-1, Integer);
19          should_pass(0, Integer);
20          should_fail(2.5, Integer);
21
22          ok_subtype(Number, Integer);
23
24          done_testing;
25

STATUS

27       This module is covered by the Type-Tiny stability policy.
28

DESCRIPTION

30       Test::TypeTiny provides a few handy functions for testing type
31       constraints.
32
33   Functions
34       "should_pass($value, $type, $test_name)"
35       "should_pass($value, $type)"
36           Test that passes iff $value passes "$type->check".
37
38       "should_fail($value, $type, $test_name)"
39       "should_fail($value, $type)"
40           Test that passes iff $value fails "$type->check".
41
42       "ok_subtype($type, @subtypes)"
43           Test that passes iff all @subtypes are subtypes of $type.
44
45       "EXTENDED_TESTING"
46           Exportable boolean constant.
47
48       "matchfor(@things)"
49           Assistant for matching exceptions. Not exported by default.  See
50           also Test::Fatal::matchfor.
51

ENVIRONMENT

53       If the "EXTENDED_TESTING" environment variable is set to true, this
54       module will promote each "should_pass" or "should_fail" test into a
55       subtest block and test the type constraint in both an inlined and non-
56       inlined manner.
57
58       This variable must be set at compile time (i.e. before this module is
59       loaded).
60

BUGS

62       Please report any bugs to
63       <http://rt.cpan.org/Dist/Display.html?Queue=Type-Tiny>.
64

SEE ALSO

66       Type::Tiny.
67
68       For an alternative to "should_pass", see Test::Deep::Type which will
69       happily accept a Type::Tiny type constraint instead of a MooseX::Types
70       one.
71

AUTHOR

73       Toby Inkster <tobyink@cpan.org>.
74
76       This software is copyright (c) 2013-2014, 2017-2020 by Toby Inkster.
77
78       This is free software; you can redistribute it and/or modify it under
79       the same terms as the Perl 5 programming language system itself.
80

DISCLAIMER OF WARRANTIES

82       THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
83       WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
84       MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
85
86
87
88perl v5.32.0                      2020-09-17                 Test::TypeTiny(3)
Impressum