JavaFan yes it does. I guess I just got lost trying to do it with one structure. Would still be interested if anyone spots a way of doing it without specifying two patterns.
Working version using JavaFan's suggestion:
use Test::More tests => 2; use Test::Deep; my $id_re = re('^\d+$'); my $vpt_re = re('^-?1$'); my $x = [ '11', '22', [ [ '-1', ], [ # '1', # only present if '22' above present ] # ] ]; my $y = [ '11', [ [ '-1', ], ] ]; my $comp1 = [ $id_re, [[$vpt_re]] ]; my $comp2 = [ $id_re, $id_re, [[$vpt_re], [$vpt_re]] ]; cmp_deeply($x, any($comp1, $comp2), 'test1'); cmp_deeply($y, any($comp1, $comp2), 'test2');
In reply to Re^2: Problem defining a Test::Deep structure to match this arrayref
by mje
in thread Problem defining a Test::Deep structure to match this arrayref
by mje
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |