{
    "mode": "perldoc",
    "parameter": "Type::Tiny::Manual::UsingWithTestMore",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Type%3A%3ATiny%3A%3AManual%3A%3AUsingWithTestMore/json",
    "generated": "2026-06-12T07:01:31Z",
    "sections": {
        "NAME": {
            "content": "Type::Tiny::Manual::UsingWithTestMore - Type::Tiny for test suites\n",
            "subsections": []
        },
        "MANUAL": {
            "content": "",
            "subsections": [
                {
                    "name": "Test::TypeTiny",
                    "content": "This is a module for testing that types you've defined accept and reject the values you think\nthey should.\n\nshouldpass($value, $type);\nshouldfail($othervalue, $type);\n\nEasy. (But yeah, I always forget whether the type goes first or second!)\n\nThere's also a function to test that subtype/supertype relationships are working okay.\n\noksubtype($type, @subtypes);\n\nOf course you can just check a type like this:\n\nok( $type->check($value) );\n\nBut the advantage of \"shouldpass\" is that if the \"EXTENDEDTESTING\" environment variable is set\nto true, \"shouldpass\" will also perform a strict check on the value, which involves climbing up\nthe type's inheritance tree (its parent, its parent's parent, etc) to make sure the value passes\nall their constraints.\n\nIf a normal check and strict check differ, this is usually a problem in the inlining code\nsomewhere.\n\nSee Test::TypeTiny for more information.\n"
                },
                {
                    "name": "Type::Tiny as a Replacement for Test::Deep",
                    "content": "Here's one of the examples from the Test::Deep documentation:\n\nmy $namere = re('^(Mr|Mrs|Miss) \\w+ \\w+$');\ncmpdeeply(\n$person,\n{\nName       => $namere,\nPhone      => re('^0d{6}$'),\nChildNames => arrayeach($namere)\n},\n\"person ok\"\n);\n\nIt's pretty easy to rewrite this to use Types::Standard:\n\nmy $name = StrMatch[ qr/^(Mr|Mrs|Miss) \\w+ \\w+$/ ];\nshouldpass(\n$person,\nDict[\nName         => $name,\nPhone        => StrMatch[ qr/^0d{6}$/ ],\nChildNames   => ArrayRef[$name]\n]\n);\n\nThere's nothing especially wrong with Test::Deep, but if you're already familiar with\nType::Tiny's built-in types and you've maybe written your own type libraries too, it will save\nyou having to switch between using two separate systems of checks.\n"
                }
            ]
        },
        "NEXT STEPS": {
            "content": "Here's your next step:\n\n*   Type::Tiny::Manual::Params\n\nAdvanced information on Type::Params, and using Type::Tiny with other signature modules like\nFunction::Parameters and Kavorka.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Toby Inkster <tobyink@cpan.org>.\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENCE": {
            "content": "This software is copyright (c) 2013-2014, 2017-2021 by Toby Inkster.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n",
            "subsections": []
        },
        "DISCLAIMER OF WARRANTIES": {
            "content": "THIS PACKAGE IS PROVIDED \"AS IS\" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,\nWITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.\n",
            "subsections": []
        }
    },
    "summary": "Type::Tiny::Manual::UsingWithTestMore - Type::Tiny for test suites",
    "flags": [],
    "examples": [],
    "see_also": []
}