1Test2::Compare::Array(3U)ser Contributed Perl DocumentatiToenst2::Compare::Array(3)
2
3
4

NAME

6       Test2::Compare::Array - Internal representation of an array comparison.
7

DESCRIPTION

9       This module is an internal representation of an array for comparison
10       purposes.
11

METHODS

13       $ref = $arr->inref()
14           If the instance was constructed from an actual array, this will
15           return the reference to that array.
16
17       $bool = $arr->ending
18       $arr->set_ending($bool)
19           Set this to true if you would like to fail when the array being
20           validated has more items than the check. That is, if you check
21           indexes 0-3 but the array has values for indexes 0-4, it will fail
22           and list that last item in the array as unexpected. If set to false
23           then it is assumed you do not care about extra items.
24
25       $hashref = $arr->items()
26           Returns the hashref of "key => val" pairs to be checked in the
27           array.
28
29       $arr->set_items($hashref)
30           Accepts a hashref to permit indexes to be skipped if desired.
31
32           Note: that there is no validation when using "set_items", it is
33           better to use the "add_item" interface.
34
35       $arrayref = $arr->order()
36           Returns an arrayref of all indexes that will be checked, in order.
37
38       $arr->set_order($arrayref)
39           Sets the order in which indexes will be checked.
40
41           Note: that there is no validation when using "set_order", it is
42           better to use the "add_item" interface.
43
44       $name = $arr->name()
45           Always returns the string "<ARRAY>".
46
47       $bool = $arr->verify(got => $got, exists => $bool)
48           Check if $got is an array reference or not.
49
50       $idx = $arr->top_index()
51           Returns the topmost index which is checked. This will return undef
52           if there are no items, or 0 if there is only 1 item.
53
54       $arr->add_item($item)
55           Push an item onto the list of values to be checked.
56
57       $arr->add_item($idx => $item)
58           Add an item to the list of values to be checked at the specified
59           index.
60
61       $arr->add_filter(sub { ... })
62           Add a filter sub. The filter receives all remaining values of the
63           array being checked, and should return the values that should still
64           be checked. The filter will be run between the last item added and
65           the next item added.
66
67       @deltas = $arr->deltas(got => $got, convert => \&convert, seen =>
68       \%seen)
69           Find the differences between the expected array values and those in
70           the $got arrayref.
71

SOURCE

73       The source code repository for Test2-Suite can be found at
74       https://github.com/Test-More/Test2-Suite/.
75

MAINTAINERS

77       Chad Granum <exodist@cpan.org>
78

AUTHORS

80       Chad Granum <exodist@cpan.org>
81
83       Copyright 2018 Chad Granum <exodist@cpan.org>.
84
85       This program is free software; you can redistribute it and/or modify it
86       under the same terms as Perl itself.
87
88       See http://dev.perl.org/licenses/
89
90
91
92perl v5.30.1                      2020-01-31          Test2::Compare::Array(3)
Impressum