TEST2::COMPARE::BAG(3pm)
π NAME π
okay so bestie, this is the manual page for Test2::Compare::Bag(3pm), straight out of the Perl Programmers Reference Guide β aka Test2::Compare::Bag, and it's the internal representation of a bag comparison. Periodt. π
π¦ DESCRIPTION π¦
This module is an internal representation of a bag for comparison purposes. That's the whole assignment, no cap. It's giving internal-only energy, and we respect it. β¨
β¨ METHODS β¨
okay bestie, gather round β every method is here, and we are not skipping a single one. π«Ά
π $bool = $arr->ending / $arr->set_ending($bool) π
So $arr->set_ending($bool) is the one with the instructions: set this to true if you would like to fail when the array being validated has more items than the check. That is, if you check for 4 items but the array has 5 values, it will fail and list that unmatched item in the array as unexpected. If set to false then it is assumed you do not care about extra items. And yeah, $bool = $arr->ending is right there in the signature list too. π
π $arrayref = $arr->items() π
Returns the arrayref of values to be checked in the array. That's it, that's the tea. π
π§ $arr->set_items($arrayref) π§
Accepts an arrayref.
Note: that there is no validation when usingset_items, it is better to use theadd_iteminterface. Yes, bestie, this is a real warning β do not come for me, I'm just the messenger. π
π $name = $arr->name() π
Always returns the string "<BAG>". Iconic, honestly. π
π«Ά $bool = $arr->verify(got => $got, exists => $bool) π«Ά
Check if $got is an array reference or not. That's the vibe check right there. π«Ά
π
$arr->add_item($item) π
Push an item onto the list of values to be checked. Slay. π
π @deltas = $arr->deltas(got => $got, convert => \&convert, seen => \%seen) π
Find the differences between the expected bag values and those in the $got arrayref. This is where the comparison does its little detective moment. π
π₯ SOURCE π₯
The source code repository for Test2-Suite can be found at https://github.com/Test-More/test-more/. Go off, repo. π₯
πΈ MAINTAINERS πΈ
Chad Granum <exodist@cpan.org>Gianni Ceccarelli <dakkar@thenautilus.net>
π AUTHORS π
Chad Granum <exodist@cpan.org>Gianni Ceccarelli <dakkar@thenautilus.net>
π COPYRIGHT π
Copyright Chad Granum <exodist@cpan.org>.
Copyright 2018 Gianni Ceccarelli <dakkar@thenautilus.net>
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/
mwah π this cutie is from perl v5.42.3, dated 2026-11-03, and the footer flavor is Test2::...are::Bag(3pm) β bye bestie, ily! πβ¨
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms