fix rangematch('zz-')
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 12 Nov 2009 20:00:37 +0000 (21:00 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 12 Nov 2009 20:02:12 +0000 (21:02 +0100)
lib/List/Index.pm
t/20-links.t

index ea7b4331c99b45bc6bccff2e94b120cb6662c30e..3663c2459422638225058204dbc9854f667f315f 100644 (file)
@@ -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;
index b1879e3abdc85b9ffec5603004f6f33e6a791d5e..afa2b7bc186d0e4b6572ef874700ee61b8d86706 100644 (file)
@@ -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'],