Help for this page

Select Code to Download


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