From: Ján Tomko Date: Wed, 15 Jun 2016 11:04:52 +0000 (+0200) Subject: test-wrap-argv: hold a copy of the original file in an array X-Git-Tag: v2.0.0-rc1~131 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0590a53a5f642a14ef41d1a66caebd4250db376;p=thirdparty%2Flibvirt.git test-wrap-argv: hold a copy of the original file in an array This will be useful to check if the file is wrapped already. --- diff --git a/tests/test-wrap-argv.pl b/tests/test-wrap-argv.pl index 1f619cc7b0..96f998a095 100755 --- a/tests/test-wrap-argv.pl +++ b/tests/test-wrap-argv.pl @@ -33,15 +33,15 @@ sub rewrap { # Read the original file open FILE, "<", $file or die "cannot read $file: $!"; - my @lines; - while () { + my @orig_lines = ; + close FILE; + my @lines = @orig_lines; + foreach (@lines) { # If there is a trailing '\' then kill the new line if (/\\$/) { chomp; $_ =~ s/\\$//; } - - push @lines, $_; } # Skip empty files @@ -49,7 +49,6 @@ sub rewrap { # Kill the last new line in the file chomp @lines[$#lines]; - close FILE; # Reconstruct the master data by joining all lines # and then split again based on the real desired