The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Test::Proto::Series - Container for test prototypes.

SYNOPSIS

        Test::Proto::Series->new(pAr,pHr)

This is a container for test prototypes and is used to create groups, repetition, and options in DTD-like validation methods such as Test::Proto::ArrayRef::contains_only. To validate arrays/lists, consider using Test::Proto::ArrayRef.

METHODS

new

Constructor. Arguments become contents.

validate_many

        my $remainder = $series->validate_many(['ONION', 'TURNIP', 'SALT']);

Tries to match all the elements in the argumnent withe the contents previously specified. It will return the remaining elements, or the first failure it runs into.

validate

        my $remainder = $series->validate('ONION');

Near-alias for validate_many, but wraps the first argument in an arrayref.

initialise

When new is called, initialise is called on the object just before it is returned. This mostly exists so that subclasses wishing to add initial tests do not have to overload new.

repeat

        pSeries($valid_key, $integer)->repeat(1,10);

Sets the minimum and maximum repeats allowed.

set_contents

        $series->set_contents([$valid_key, $integer]);

Sets the contents allowed in the series. Returns the series.

clone

        my $series = pSeries($valid_key, $integer)->repeat(1,10);
        $series->clone->repeat(1,20)->validate_many($long_key_list);

Creates a copy of the series. Individual contents remain references.

upgrade

Works like Test::Proto::Base::Upgrade, s.v.

OTHER INFORMATION

For author, version, bug reports, support, etc, please see Test::Proto.