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') ]; };