ThaiSchema

 view release on metacpan or  search on metacpan

t/01_types.t  view on Meta::CPAN

use strict;
use warnings;
use utf8;
use Test::More;
use ThaiSchema;
use JSON ();

BEGIN { *describe = *context = *it = *Test::More::subtest }

sub strict_context(&) {
    local $ThaiSchema::STRICT = 1;
    $_[0]->();
}
sub normal_context(&) {
    local $ThaiSchema::STRICT = 0;
    $_[0]->();
}

describe 'int' => sub {
    normal_context {
        ok(type_int()->match(1));
        ok(type_int()->match(0), 'zero');
        ok(type_int()->match('1'));
        ok(!type_int()->match(3.14));



( run in 0.260 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )