| 1 | package Test::Proto::Series; | ||
| 2 | 5 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 5 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 5 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | has 'contents', | ||
| 7 | is => 'rw', | ||
| 8 | 0 | ▶ | default => sub { [] }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 9 | |||
| 10 | 48 | ▶ | sub BUILDARGS { |
|
Subroutine
BUILDARGS: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 11 | 48 | my $class = shift; | |
| 12 | 48 | return { contents => [@_] }; | |
| 13 | } | ||
| 14 | |||
| 15 | 5 | around 'contents' => \&Test::Proto::Common::chainable; | |
| 16 | |||
| 17 | =head1 NAME | ||
| 18 | |||
| 19 | Test::Proto::Series - represent a series in array validation | ||
| 20 | |||
| 21 | =head1 SYNOPSIS | ||
| 22 | |||
| 23 | pArray->contains_only(pSeries('a', 'b', 'c')); | ||
| 24 | # will validate ['a', 'b', 'c'] as true | ||
| 25 | |||
| 26 | Used in array validation to represent a sequence which must be present in its entirety. Only really useful when used in combination with L<Test::Proto::Repeatable> and L<Test::Proto::Alternation>, which can be nested inside a series, or can contain a series. | ||
| 27 | |||
| 28 | =head1 METHODS | ||
| 29 | |||
| 30 | =head3 new | ||
| 31 | |||
| 32 | Each argument is another element in the series. | ||
| 33 | |||
| 34 | =head3 contents | ||
| 35 | |||
| 36 | die unless exists $alternation->contents->[0]; | ||
| 37 | |||
| 38 | A chainable getter/setter method for the contents of the series. | ||
| 39 | |||
| 40 | =cut | ||
| 41 | |||
| 42 | 5 | 1; | |