X-Git-Url: http://git.shiar.net/perl/list-index.git/blobdiff_plain/a0438ade03450c7141821f7f8aa25d3a8e39d849..e5fa8cd7b5cc84943c5f7c32c4f34974613a235b:/t/10-ranges.t diff --git a/t/10-ranges.t b/t/10-ranges.t index 55df649..d96ebb5 100644 --- a/t/10-ranges.t +++ b/t/10-ranges.t @@ -54,26 +54,31 @@ subtest 'context' => sub { }; subtest 'distribution' => sub { - plan tests => 2; + plan tests => 3; my $index = List::Index->new([qw( - kkeg kl km kmlu knsy koxb kpeo kqbt krzu ktyp - kuap kuy kvbc kyy kzb lc lg lgaa lgbv lgbw - lgu lij ljr ljs lka lkq lks lln llq llx + kkeg kl km kmlu knsy koxb kpeo kuaa kuab kuac + kuap kuaq kuq kux kzb lc lg lgu lgua lguc + lguq lgur lgus lgx lka lkq lks lln llq llx )]) or return; -TODO: { - local $TODO = 'under development'; is_deeply( - $index->ranges({ pagesize=>10, context=>5 }), - # after 'kuap' forwards to 'kzb', 'lgu' shouldn't go back to 'lc' - # otherwise we get qw[-k l-] - [qw(-k l-lg lgu-)], - 'lookbehind after full lookahead' + $index->ranges({ pagesize=>10, context=>3 }), + # shorten 'kuap' to 'ku' because lookbehind is 'kp...' + # 'lguq' matches 'lg', but may only backtrack to 'lgu' + [qw(-kt ku-lgt lgu-)], + 'lookbehind' ); -} is_deeply( $index->ranges({ pagesize=>10, context=>4 }), [qw(-kt ku-lf lg-)], 'maximal lookahead' ); + is_deeply( + $index->ranges({ pagesize=>10, context=>5 }), + # after forwarding 'kuap' to 'lc' + # disallow backtracking of 'lguq' to 'lc' to prevent qw[-k l-] + # so only lookahead (to 'lkq') remains + [qw(-k l-lj lk-)], + 'lookbehind after full lookahead' + ); }