From f201c1cafae5e0a87e562961316c7650b0e2231a Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 12 Nov 2009 21:00:37 +0100 Subject: [PATCH] fix rangematch('zz-') --- lib/List/Index.pm | 1 + t/20-links.t | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) 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'], -- 2.30.0