The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
use strict;
use warnings;

use Test::More;
my $tests = 13;
plan tests => $tests;

my $class = 'Form::Processor::Field::WeekdayStr';


use_ok( $class );
my $field = $class->new(
    name     => 'test_field',
    type     => 'WeekdayStr',
    form     => undef,
    multiple => 1,
);

ok( defined $field, 'new() called' );

for ( 0 .. 6 ) {
    $field->input( $_ );
    $field->validate_field;
    ok( !$field->has_error, $_ . ' is valid' );
}

$field->input( -1 );
$field->validate_field;
ok( $field->has_error, '-1 is not valid day of the week' );

$field->input( 7 );
$field->validate_field;
ok( $field->has_error, '7 is not valid day of the week' );


$field->input( [ 1, 3, 5 ] );
$field->validate_field;
ok( !$field->has_error, '1 3 5 is valid days of the week' );

$field->input( [ 1, 3, 7 ] );
$field->validate_field;
ok( $field->has_error, '1 3 7 included invalid 7' );