Config-Identity
view release on metacpan or search on metacpan
t/01-basic.t view on Meta::CPAN
eval { Config::Identity->load_check('pause-alternate', "notfound1") };
like( $@, qr/^Argument to check keys must be an arrayref or coderef/, "load_check croaks on bad argument" );
eval { Config::Identity->load_check('pause-alternate',[qw/notfound1 password/]) };
like( $@, qr/^Missing required field: notfound1/, "load_check detected missing field" );
eval { Config::Identity->load_check('pause-alternate',[qw/notfound1 notfound2 password/]) };
like( $@, qr/^Missing required fields: notfound1 notfound2/, "load_check detected missing fields" );
my $checker = sub {
is( "$_", "$_[0]", "checker sub has same \$_ and \$[0]" );
cmp_deeply( $_, $expected, "checker sub has expected fields in \$_" );
return "notfound1"; # fake error
};
eval { Config::Identity->load_check('pause-alternate', $checker) };
like( $@, qr/^Missing required field: notfound1/, "load_check detected missing field (from checker sub)" );
}
SKIP: {
( run in 0.642 second using v1.01-cache-2.11-cpan-cc502c75498 )