For testing portions of lists, we have the bag and set interfaces, but both of these are unordered. It would be nice to have interfaces that test ordered slices of lists.
Sadly, this does not work:
cmp_deeply(
[ 'foo', 'bar', 'baz' ],
[
'foo',
'bar',
(any(ignore(), ())) x 20, # from 0 to 20 extra elements
],
'foo and bar appear in this order at the beginning of the list',
);
we get: ... 'got: array with 3 elements... expect: array with 22 elements' :/