From: Mischa POSLAWSKY Date: Thu, 12 Nov 2009 20:00:37 +0000 (+0100) Subject: fix rangematch('zz-') X-Git-Url: http://git.shiar.nl/perl/list-index.git/commitdiff_plain/f201c1cafae5e0a87e562961316c7650b0e2231a fix rangematch('zz-') --- diff --git a/lib/List/Index.pm b/lib/List/Index.pm index ea7b433..3663c24 100644 --- a/lib/List/Index.pm +++ b/lib/List/Index.pm @@ -92,6 +92,7 @@ sub rangematch { my $next = $char; $next = chr( ord($char) + 1 ) if length $s1 > $i + 1; my $last = 'z'; + next if $next gt $last; if (length $s2 > $i) { if ($s2 =~ /^\Q$prefix/) { $last = substr $s2, $i, 1; diff --git a/t/20-links.t b/t/20-links.t index b1879e3..afa2b7b 100644 --- a/t/20-links.t +++ b/t/20-links.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 28; +use Test::More tests => 29; use Test::NoWarnings; use Data::Dump 'pp'; @@ -17,6 +17,7 @@ for ( [ -qqq => '(?:(?![q-z])|q(?![q-z])|qq(?![q-z])|qqq)'], [ 'q-' => '[q-z]'], ['qqq-' => '(?:[r-z]|q[r-z]|qq[q-z])'], + ['zzz-' => 'zz[z-z]'], [ 'q-x' => '[q-x]'], [ 'q-q' => 'q'], [ 'qq-qq' => 'qq'],