NAME
Test::Validator::Declarative - Tests for declarative parameters validation
VERSION
version 1.20130722.2105
SYNOPSIS
# 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,
],
},
);
DESCRIPTION
Simple helpers to write tests for your own types and converters.
METHODS
check_type_validation( %params )
Hash %params can accept following keys:
type
Type definition to be checked - just type name, or something more complex.
good
Reference to array of values that should pass verification.
bad
Reference to array of values that should fail verification.
check_converter_validation( %params )
Hash %params can accept following keys:
type
Converter definition to be checked - just converter name, or something more complex.
result
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).
EXAMPLES
For more examples, see sources of test suite.
AUTHOR
Oleg Kostyuk, <cub at cpan.org>
BUGS
Please report any bugs or feature requests to Github https://github.com/cub-uanic/Validator-Declarative
AUTHOR
Oleg Kostyuk <cub@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Oleg Kostyuk.
This is free software, licensed under:
The (three-clause) BSD License