my $o = bless { x => bless ['y'], 'My::Value' }, 'My::Class';
####
{ x => [$v], # where $v is 'y' or 'z'
a => 'b' } # if a exists at all
##
##
cmp_deeply $o, noclass(subhashof({ a => 'b', x => subbagof('y', 'z') }));
##
##
# Failed test at ...
# Comparing $data->{"x"} as a SubBag
# got : My::Value=ARRAY(0x561fbd1fe3a8)
# expect : An array to use as a Bag
##
##
cmp_deeply { x => ['y'] },
subhashof({ a => 'b', x => subbagof('y', 'z') });
##
##
use Test2::Tools::Compare qw{ like hash item field in_set DNE bag };
my $o = bless { x => bless ['y'], 'My::Value' }, 'My::Class';
like({ x => ['y'] },
hash { field a => in_set(DNE(), 'b');
field x => bag { item in_set('y', 'z') };
}
);
like $o, hash { field a => in_set(DNE(), 'b');
field x => [ in_set('y', 'z') ];
};