Test::Deep::HashRec - test hash entries for required and optional fields
version 0.004
This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years.
Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl.
cmp_deeply( $got, hashrec({ required => { count => any(1,2,3), b => ignore() }, optional => { name => { first => ignore(), last => ignore() } }, }), "we got a valid record", );
hashrec returns a Test::Deep comparator that asserts that:
hashrec
all required elements are present
nothing other than required and optional elements are present
all present elements match the comparator given for them
If you pass a true allow_unknown argument, then unknown elements will be permitted, and their values ignored.
allow_unknown
Ricardo Signes <cpan@semiotic.systems>
Ricardo Signes <rjbs@semiotic.systems>
This software is copyright (c) 2022 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Test::Deep::HashRec, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Deep::HashRec
CPAN shell
perl -MCPAN -e shell install Test::Deep::HashRec
For more information on module installation, please visit the detailed CPAN module installation guide.