Test::S...::Array(3)

πŸ“¦
version 1.302027 Β· 2 versions
, in fedora 43

πŸ’– Test::S...::Array πŸ’–

okay bestie, welcome to the manual page for Test::S...::Array β€” that's an internal representation of an array comparison, from the User Contributed Perl Documentation, no cap. it's giving "plumbing, not faucet" energy, but we're gonna vibe through it together 🫢


🌸 NAME 🌸

Test::Stream::Compare::Array β€” the internal representation of an array comparison. that's it, that's the whole name. lowkey iconic ✨


πŸ’€ DEPRECATED πŸ’€

not me having to tell you this but… this distribution is deprecated in favor of Test2, Test2::Suite, and Test2::Workflow. it's over, bestie 😭

if you need to migrate, go read Test::Stream::Manual::ToTest2 β€” that's the conversion guide, it's got you πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

this module is the internal representation of an array, for comparison purposes. like, it's the backstage pass version of an array β€” you're not really supposed to hang out with it directly, but here we are πŸŽ€


✨ METHODS ✨

  • $ref = $arr->inref() β€” if this instance was built from an actual, real, flesh-and-blood array, this hands you back the reference to that array. periodt πŸ’–
  • $bool = $arr->ending
  • $arr->set_ending($bool) β€” set this to true if you want things to fail when the array being validated has more items than the check does. so like, if you check indexes 0-3 but the array you got actually has values for indexes 0-4, it will fail and list that last item as unexpected. if it's false, we assume you simply do not care about extra items. your vibe, your choice 🧚
  • $hashref = $arr->items()
  • $arr->set_items($hashref) β€” this gives you the hashref of "key => val" pairs that are gonna be checked in the array. it's a hashref specifically so that indexes can be skipped if you feel like it. no skipping leg day, but indexes? sure, go off πŸ’…
note: there is no validation when you use set_items. it's way better to use the add_item interface instead. don't be messy, bestie πŸ™ˆ
  • $arrayref = $arr->order()
  • $arr->set_order($arrayref) β€” this gives you an arrayref of all the indexes that will be checked, in order. we love a well-ordered queue ✨
note: again, there is no validation when you use set_order. the add_item interface is the better move. i'm just the messenger 😭
  • $name = $arr->name() β€” always returns the string "<ARRAY>". every single time. no surprises. queen of consistency πŸ‘‘
  • $bool = $arr->verify(got => $got, exists => $bool) β€” check whether $got is an array reference or not. simple. clean. slay.
  • $idx = $arr->top_index() β€” get the topmost index that actually gets checked. this returns undef if there are no items at all, and 0 is returned if there's only 1 item. math is mathing πŸ“
  • $arr->add_item($item)
  • $arr->add_item($idx => $item) β€” add an item to the list of values to check. if you omit the index, the next index after the last one gets used automatically. so chill of it 🌈
  • $arr->add_filter(sub { ... }) β€” add a filter sub. the filter receives all remaining values of the array being checked, and it should return the values that should still be checked. the filter runs between the last item added and the next item added. it's giving little bouncer at the club door πŸŽ€
  • @deltas = $arr->deltas(got => $got, convert => \&convert, seen => \%seen) β€” find the differences between the expected array values and the ones sitting inside the $got arrayref. this is the drama detector fr fr πŸ’€

πŸ”₯ SOURCE πŸ”₯

the source code repository for Test::Stream lives at http://github.com/Test-More/Test-Stream/ β€” go star it, it's free πŸ’œ


πŸ‘‘ MAINTAINERS πŸ‘‘

Chad Granum <exodist@cpan.org>


🌟 AUTHORS 🌟

Chad Granum <exodist@cpan.org>


Copyright 2015 Chad Granum <exodist7@gmail.com>.

this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

see http://dev.perl.org/licenses/


and that's the whole page, bestie!! this one shipped with perl v5.42.0 and was dated 2025-07-25 β€” so go forth, compare those arrays, and remember: no cap, the facts stay exactly where they were πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from