From 83537f241502777972df808e97185139c147bf8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A4r=20Karlsson?= Date: Tue, 19 May 2015 22:20:17 +0200 Subject: [PATCH] Fix undeclared loop variable in Perl test suite Reported-by: Hubert Tarasiuk --- tests/WgetTests.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/WgetTests.pm b/tests/WgetTests.pm index 501aeba8..34253b12 100644 --- a/tests/WgetTests.pm +++ b/tests/WgetTests.pm @@ -265,13 +265,12 @@ sub _show_diff my $min = $explen <= $actlen ? $explen : $actlen; my $line = 1; my $col = 1; - my $i; + my $i = 0; - # for ($i=0; $i != $min; ++$i) { - for my $i (0 .. $min - 1) + while ( $i < $min ) { last if substr($expected, $i, 1) ne substr $actual, $i, 1; - if (substr($expected, $i, 1) eq q{\n}) + if (substr($expected, $i, 1) eq "\n") { $line++; $col = 0; @@ -280,6 +279,7 @@ sub _show_diff { $col++; } + $i++; } my $snip_start = $i - ($SNIPPET_SIZE / 2); if ($snip_start < 0)