The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

#!perl
use strict;
use Test::More (tests => 4);
BEGIN
{
use_ok("Data::FormValidator::Constraints::Japanese");
}
my $dfv = Data::FormValidator->new('t/profile.pl');
my @inputs = (
{ text => "¤Û¤²¤Û¤²¤Û¤²", ok => 1 },
{ text => "¤Û¤²¤Û¤²¤Û¤²¤Û¤²", ok => 0 },
{ text => "¤²¤Û¤²", ok => 0 },
);
for (@inputs) {
my $rv = $dfv->check({ text => $_->{text} }, 'length');
if ($_->{ok}) {
ok(! $rv->has_invalid && ! $rv->has_missing && ! $rv->has_unknown, "$_->{text} should pass");
} else {
ok($rv->has_invalid && ! $rv->has_missing && ! $rv->has_unknown, "$_->{text} should fail");
}
}
1;