Test::Validator::Declarative - Tests for declarative parameters validation
version 1.20130722.2105
# t/converters/assume_true.t use strict; use warnings; use Test::Validator::Declarative qw/ check_converter_validation /; check_converter_validation( type => 'assume_true', result => { 1 => [ ## all TRUEs 'T', 'TRUE', 'Y', 'YES', 't', 'true', 'y', 'yes', 1, '', # empty string 'some string', # arbitrary string 10, # arbitrary number 'NOT', # mistype sub { return 'TRUE' }, # coderef ], 0 => [ ## all FALSEs 'F', 'FALSE', 'N', 'NO', 'f', 'false', 'n', 'no', 0, ], }, );
Simple helpers to write tests for your own types and converters.
Hash %params can accept following keys:
Type definition to be checked - just type name, or something more complex.
Reference to array of values that should pass verification.
Reference to array of values that should fail verification.
Converter definition to be checked - just converter name, or something more complex.
Reference to hash of result/values that will be passed thru converter. Values can be represented as single value or as arrayref to set of values (where all of them should issue same result after conversion).
For more examples, see sources of test suite.
Oleg Kostyuk, <cub at cpan.org>
<cub at cpan.org>
Please report any bugs or feature requests to Github https://github.com/cub-uanic/Validator-Declarative
Oleg Kostyuk <cub@cpan.org>
This software is Copyright (c) 2013 by Oleg Kostyuk.
This is free software, licensed under:
The (three-clause) BSD License
To install Validator::Declarative, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Validator::Declarative
CPAN shell
perl -MCPAN -e shell install Validator::Declarative
For more information on module installation, please visit the detailed CPAN module installation guide.