httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ran...@apache.org
Subject svn commit: r529126 - in /httpd/apreq/trunk/glue/perl/t: apreq/cgi.t apreq/upload.t response/TestApReq/upload.pm
Date Mon, 16 Apr 2007 03:27:27 GMT
Author: randyk
Date: Sun Apr 15 20:27:26 2007
New Revision: 529126

URL: http://svn.apache.org/viewvc?view=rev&rev=529126
Log:
report individual results on upload tests, for easier diagnostics.

Modified:
    httpd/apreq/trunk/glue/perl/t/apreq/cgi.t
    httpd/apreq/trunk/glue/perl/t/apreq/upload.t
    httpd/apreq/trunk/glue/perl/t/response/TestApReq/upload.pm

Modified: httpd/apreq/trunk/glue/perl/t/apreq/cgi.t
URL: http://svn.apache.org/viewvc/httpd/apreq/trunk/glue/perl/t/apreq/cgi.t?view=diff&rev=529126&r1=529125&r2=529126
==============================================================================
--- httpd/apreq/trunk/glue/perl/t/apreq/cgi.t (original)
+++ httpd/apreq/trunk/glue/perl/t/apreq/cgi.t Sun Apr 15 20:27:26 2007
@@ -47,7 +47,7 @@
 my @big_keys    = ('a'..'z');
 
 plan tests => 10 + @key_len * @key_num + @big_key_len * @big_key_num +
-  @names * @methods, need_lwp && need_cgi;
+  4 * @names * @methods, need_lwp && need_cgi;
 
 require HTTP::Cookies;
 
@@ -194,14 +194,15 @@
         my $result = UPLOAD_BODY("$script?method=$method;has_md5=$has_md5",
                                  filename => $file);
         $result =~ s{\r}{}g;
-        my $expected = <<END;
-
-type: $types{$basename}
-size: $size
-filename: $basename
-md5: $cs
-END
-        ok t_cmp($result, $expected, "$method test for $basename");
+        my %h = map {$_;} split /[=&;]/, $result, -1;
+        ok t_cmp($h{type}, $types{$basename},
+	    "'type' test for $method on $basename");
+        ok t_cmp($h{filename}, $basename,
+	    "'filename' test for $method on $basename");
+        ok t_cmp($h{size}, $size,
+	    "'size' test for $method on $basename");
+        ok t_cmp($h{md5}, $cs,
+	    "'checksum' test for $method on $basename");
     }
     unlink $file if -f $file;
 }
@@ -319,14 +320,8 @@
     my $cs = $has_md5 ? cs($temp_file) : 0;
 
     my $size = -s $temp_file;
-    print <<"END";
-
-
-type: $type
-size: $size
-filename: $basename
-md5: $cs
-END
+    my $result = qq{type=$type;size=$size;filename=$basename;md5=$cs};
+    print "Content-Type: text/plain\n\n$result";
     unlink $temp_file if -f $temp_file;
 }
 

Modified: httpd/apreq/trunk/glue/perl/t/apreq/upload.t
URL: http://svn.apache.org/viewvc/httpd/apreq/trunk/glue/perl/t/apreq/upload.t?view=diff&rev=529126&r1=529125&r2=529126
==============================================================================
--- httpd/apreq/trunk/glue/perl/t/apreq/upload.t (original)
+++ httpd/apreq/trunk/glue/perl/t/apreq/upload.t Sun Apr 15 20:27:26 2007
@@ -32,7 +32,7 @@
 my @names = sort keys %types;
 my @methods = sort qw/slurp fh tempname link io/;
 
-plan tests => @names * @methods, need_lwp;
+plan tests => 4 * @names * @methods, need_lwp;
 
 foreach my $name (@names) {
     my $url = ( ($name =~ /\.(pod|pm)$/) ?
@@ -52,18 +52,18 @@
     my $size = -s $file;
     my $cs = $has_md5 ? cs($file) : 0;
     my $basename = File::Basename::basename($file);
-
     for my $method ( @methods) {
         my $result = UPLOAD_BODY("$location?method=$method;has_md5=$has_md5",
                                  filename => $file);
-        my $expected = <<END;
-
-type: $types{$basename}
-size: $size
-filename: $basename
-md5: $cs
-END
-        ok t_cmp($result, $expected, "$method test for $basename");
+        my %h = map {$_;} split /[=&;]/, $result, -1;
+        ok t_cmp($h{type}, $types{$basename},
+	    "'type' test for $method on $basename");
+        ok t_cmp($h{filename}, $basename,
+	    "'filename' test for $method on $basename");
+        ok t_cmp($h{size}, $size,
+	    "'size' test for $method on $basename");
+        ok t_cmp($h{md5}, $cs,
+	    "'checksum' test for $method on $basename");
     }
     unlink $file if -f $file;
 }

Modified: httpd/apreq/trunk/glue/perl/t/response/TestApReq/upload.pm
URL: http://svn.apache.org/viewvc/httpd/apreq/trunk/glue/perl/t/response/TestApReq/upload.pm?view=diff&rev=529126&r1=529125&r2=529126
==============================================================================
--- httpd/apreq/trunk/glue/perl/t/response/TestApReq/upload.pm (original)
+++ httpd/apreq/trunk/glue/perl/t/response/TestApReq/upload.pm Sun Apr 15 20:27:26 2007
@@ -64,13 +64,8 @@
 
     $req->content_type('text/plain');
     my $size = -s $temp_file;
-    $r->print(<<END);
-
-type: $type
-size: $size
-filename: $basename
-md5: $cs
-END
+    my $result = qq{type=$type;size=$size;filename=$basename;md5=$cs};
+    $r->print($result);
     unlink $temp_file if -f $temp_file;
     return Apache2::Const::OK;
 }



Mime
View raw message