I am looking for a test procedure, for example is_deeply in Test::More . There cmp_bag from Test::Deep , but this only works on the array itself, and not on the terribly large hashes of data hashes, the structure I am passing. Is there something like:
is_deeply $got, $expected, { array => cmp_bag,
Explanation
I could recursively dig into my $expected and $got objects and convert arrays to bag objects:
sub bagIt { my $obj = shift; switch (ref($obj)) { case "ARRAY" { return bag([ map { $_ = bagIt($_) } @$obj ]); } case "HASH" { return { map { $_ => bagIt( $obj->{$_} ) } keys %$obj }; } else { return $obj; } } }
I am wondering if there is a way to tell some is_deeply option to do this for me.
source share