Skip to content

Commit a7d56d6

Browse files
haargsimbabque
authored andcommitted
fix compatibility with ancient perl by avoiding index in test
Perl 5.8.5 and older have bugs in the index function that prevent it from matching a downgraded string to an upgraded string. Regex matches don't suffer from the same bug, so we can use them instead and be compatible with all relevant versions.
1 parent 691334d commit a7d56d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

t/parser.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ for my $chunksize (64 * 1024, 64, 13, 3, 1, "file", "filehandle") {
163163
"|>>body<<|\n\n|",
164164
)
165165
{
166-
if (index($res, $_) < 0) {
166+
if ($res !~ /\Q$_\E/) {
167167
diag "Can't find '$_' in parsed document";
168168
$bad++;
169169
}

0 commit comments

Comments
 (0)