Test::TypeTiny(3)
πΈ NAME πΈ
Test::TypeTiny β literally the actually-useful functions for testing the efficacy of type constraints π
(and yup, this is from the User Contributed Perl Documentation manual, section 3 β you found it, bestie π)
β¨ SYNOPSIS β¨
use strict;
use warnings;
use Test::More;
use Test::TypeTiny;
use Types::Mine qw(Integer Number);
should_pass(1, Integer);
should_pass(-1, Integer);
should_pass(0, Integer);
should_fail(2.5, Integer);
ok_subtype(Number, Integer);
done_testing;
That's the whole vibe, no cap. Copy it, run it, slay π¦
π¦ STATUS π¦
This module is covered by the Type-Tiny stability policy. That's it, that's the status β iconic and stable π
π DESCRIPTION π
Test::TypeTiny provides a few handy functions for testing type constraints. It's giving "small module, big main-character energy" π₯
π FUNCTIONS π
should_pass($value, $type, $test_name)should_pass($value, $type)β Test that passes iff$valuepasses$type->check. So like, if the value behaves, the test goes green πshould_fail($value, $type, $test_name)should_fail($value, $type)β Test that passes iff$valuefails$type->check. Yes bestie, sometimes you want it to fail, and this test passes when it does πok_subtype($type, @subtypes)β Test that passes iff all@subtypesare subtypes of$type. Family tree check, but make it a test πEXTENDED_TESTINGβ Exportable boolean constant. It's a constant. It's boolean. It's exportable. Periodt οΏ½οΏ½matchfor(@things)β Assistant for matching exceptions. Not exported by default! π See alsoTest::Fatal::matchfor.
π ENVIRONMENT π
If the EXTENDED_TESTING environment variable is set to true, this module will promote each should_pass or should_fail test into a subtest block and test the type constraint in both an inlined and non-inlined manner. Overachiever behaviour, honestly π
π¨ This variable must be set at compile time (i.e. before this module is loaded). Compile time, not runtime β timing is everything, bestie π
π BUGS π
Please report any bugs to https://github.com/tobyink/p5-type-tiny/issues. Found a bug? Don't suffer in silence, tell the maintainer π«Ά
β SEE ALSO β
Type::Tiny.
For an alternative to should_pass, see Test::Deep::Type which will happily accept a Type::Tiny type constraint instead of a MooseX::Types one. Options! We love options π
π«Ά AUTHOR π«Ά
Toby Inkster <tobyink@cpan.org>. The legend behind all this β¨
π COPYRIGHT AND LICENCE π
This software is copyright (c) 2013-2014, 2017-2025 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Free as in "go off, bestie" π
π DISCLAIMER OF WARRANTIES π
β οΈ Okay so: THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. Translation: no promises, no guarantees, use at your own risk ππ
and that's the entire page, bestie!! π you just read Test::TypeTiny(3), brought to you by perl v5.42.2, dated 2026-04-07. now go forth and make those type constraints pass their vibe check πΈπ¦β¨
π¦ where this page comes from
- alpine 3.24: perl-type-tiny-doc 2.010001-r0 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms