1Test::Stream::Compare::UAsrerrayC(o3n)tributed Perl DocuTmeesntt:a:tSitorneam::Compare::Array(3)
2
3
4
6 Test::Stream::Compare::Array - Internal representation of an array
7 comparison.
8
10 This distribution is deprecated in favor of Test2, Test2::Suite, and
11 Test2::Workflow.
12
13 See Test::Stream::Manual::ToTest2 for a conversion guide.
14
16 This module is an internal representation of an array for comparison
17 purposes.
18
20 $ref = $arr->inref()
21 If the instance was constructed from an actual array, this will
22 have the reference to that array.
23
24 $bool = $arr->ending
25 $arr->set_ending($bool)
26 Set this to true if you would like to fail when the array being
27 validated has more items than the check. That is if you check
28 indexes 0-3, but the array received has values for indexes 0-4, it
29 will fail and list that last item in the array as unexpected. If
30 this is false then it is assumed you do not care about extra items.
31
32 $hashref = $arr->items()
33 $arr->set_items($hashref)
34 This gives you the hashref of "key => val" pairs to be checked in
35 the array. This is a hashref so that indexes can be skipped if
36 desired.
37
38 Note: that there is no validation when using "set_items", it is
39 better to use the "add_item" interface.
40
41 $arrayref = $arr->order()
42 $arr->set_order($arrayref)
43 This gives you an arrayref of all indexes that will be checked, in
44 order.
45
46 Note: that there is no validation when using "set_order", it is
47 better to use the "add_item" interface.
48
49 $name = $arr->name()
50 Always returns the string "<ARRAY>".
51
52 $bool = $arr->verify(got => $got, exists => $bool)
53 Check if $got is an array reference or not.
54
55 $idx = $arr->top_index()
56 Get the topmost index that gets checked. This will return undef if
57 there are no items, 0 is returned if there is only 1 item.
58
59 $arr->add_item($item)
60 $arr->add_item($idx => $item)
61 Add an item to the list of values to check. If index is omitted
62 then the next index after the last is used.
63
64 $arr->add_filter(sub { ... })
65 Add a filter sub. The filter receives all remaining values of the
66 array being checked, and should return the values that should still
67 be checked. The filter will be run between the last item added and
68 the next item added.
69
70 @deltas = $arr->deltas(got => $got, convert => \&convert, seen =>
71 \%seen)
72 Find the differences between the expected array values and those in
73 the $got arrayref.
74
76 The source code repository for Test::Stream can be found at
77 http://github.com/Test-More/Test-Stream/.
78
80 Chad Granum <exodist@cpan.org>
81
83 Chad Granum <exodist@cpan.org>
84
86 Copyright 2015 Chad Granum <exodist7@gmail.com>.
87
88 This program is free software; you can redistribute it and/or modify it
89 under the same terms as Perl itself.
90
91 See http://dev.perl.org/licenses/
92
93
94
95perl v5.38.0 2023-07-21 Test::Stream::Compare::Array(3)