summaryrefslogtreecommitdiff
path: root/tests/getpart.pm
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-11-30 09:53:53 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-11-30 09:53:53 +0000
commit4781ff88fd4d32cce653d466146c71da92f68ee2 (patch)
tree0a7ab30f1c402462c09e80aba08ec1bcb0bfcdf1 /tests/getpart.pm
parentc28e15c68249a897be37d2bf5e49ab02d60479a6 (diff)
downloadcurl-4781ff88fd4d32cce653d466146c71da92f68ee2.tar.gz
Fixed the array comparison function even more, made the temporary files used
for diff output get created in the log/ dir and no longer deletes them since they help in understanding the problem, fixing the test case and fixing curl problems.
Diffstat (limited to 'tests/getpart.pm')
-rw-r--r--tests/getpart.pm33
1 files changed, 8 insertions, 25 deletions
diff --git a/tests/getpart.pm b/tests/getpart.pm
index 48be6c2da..898ecec6b 100644
--- a/tests/getpart.pm
+++ b/tests/getpart.pm
@@ -154,22 +154,8 @@ sub striparray {
sub compareparts {
my ($firstref, $secondref)=@_;
- my $sizefirst=scalar(@$firstref);
- my $sizesecond=scalar(@$secondref);
-
- my $first;
- my $second;
-
- for(1 .. $sizefirst) {
- my $index = $_ - 1;
- if($firstref->[$index] ne $secondref->[$index]) {
- (my $aa = $firstref->[$index]) =~ s/\r+\n$/\n/;
- (my $bb = $secondref->[$index]) =~ s/\r+\n$/\n/;
-
- $first .= $firstref->[$index];
- $second .= $secondref->[$index];
- }
- }
+ my $first = join("", @$firstref);
+ my $second = join("", @$secondref);
# we cannot compare arrays index per index since with the base64 chunks,
# they may not be "evenly" distributed
@@ -214,16 +200,14 @@ sub loadarray {
return @array;
}
-#
-# Given two array references, this function will store them in two
-# temporary files, run 'diff' on them, store the result, remove the
-# temp files and return the diff output!
-#
+# Given two array references, this function will store them in two temporary
+# files, run 'diff' on them, store the result and return the diff output!
+
sub showdiff {
- my ($firstref, $secondref)=@_;
+ my ($logdir, $firstref, $secondref)=@_;
- my $file1=".generated";
- my $file2=".expected";
+ my $file1="$logdir/check-generated";
+ my $file2="$logdir/check-expected";
open(TEMP, ">$file1");
for(@$firstref) {
@@ -238,7 +222,6 @@ sub showdiff {
close(TEMP);
my @out = `diff -u $file2 $file1`;
- unlink $file1, $file2;
return @out;
}