perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/t/response/TestModules cgi.pm
Date Mon, 19 Nov 2001 22:08:17 GMT
dougm       01/11/19 14:08:17

  Modified:    t/modules cgi.t
               t/response/TestModules cgi.pm
  Log:
  make cgi test easier to debug/run subtests
  
  Revision  Changes    Path
  1.5       +35 -15    modperl-2.0/t/modules/cgi.t
  
  Index: cgi.t
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/modules/cgi.t,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- cgi.t	2001/06/27 05:36:51	1.4
  +++ cgi.t	2001/11/19 22:08:17	1.5
  @@ -3,24 +3,44 @@
   
   use Apache::Test;
   use Apache::TestRequest;
  +use Apache::TestUtil;
   
  -plan tests => 6, \&have_lwp;
  +plan tests => 5, \&have_lwp;
   
   my $module = 'TestModules::cgi';
   my $location = "/$module";
   
  -ok 1;
  +my($res, $str);
   
  -my $res = GET "$location?PARAM=2";
  -my $str = $res->content;
  -ok $str eq "ok 2\n" or print "str=$str";
  -
  -$str = POST_BODY $location, content => 'PARAM=%33';
  -ok $str eq "ok 3\n" or print "str=$str";
  -
  -$str = UPLOAD_BODY $location, content => 4;
  -ok $str eq "ok 4\n" or print "str=$str";
  -
  -ok $res->header('Content-type') =~ m:^text/test-output:;
  -
  -ok $res->header('X-Perl-Module') eq $module;
  +sok {
  +    my $url = "$location?PARAM=2";
  +    $res = GET $url;
  +    $str = $res->content;
  +    t_cmp("ok 2", $str, "GET $url");
  +};
  +
  +sok {
  +    my $content = 'PARAM=%33';
  +    $str = POST_BODY $location, content => $content;
  +    t_cmp("ok 3", $str, "POST $location\n$content");
  +};
  +
  +sok {
  +    $str = UPLOAD_BODY $location, content => 4;
  +    t_cmp("ok 4", $str, 'file upload');
  +};
  +
  +sok {
  +    my $header = 'Content-type';
  +    $res = GET $location;
  +    t_cmp(qr{^text/test-output},
  +          $res->header($header),
  +          "$header header");
  +};
  +
  +sok {
  +    my $header = 'X-Perl-Module';
  +    $res = GET $location;
  +    t_cmp($module, $module,
  +          "$header header");
  +};
  
  
  
  1.9       +2 -2      modperl-2.0/t/response/TestModules/cgi.pm
  
  Index: cgi.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestModules/cgi.pm,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- cgi.pm	2001/09/28 17:15:08	1.8
  +++ cgi.pm	2001/11/19 22:08:17	1.9
  @@ -38,10 +38,10 @@
           no strict;
           local $/;
           my $content = <$httpupload>;
  -        print "ok $content\n";
  +        print "ok $content";
       }
       elsif ($param) {
  -        print "ok $param\n";
  +        print "ok $param";
       }
       else {
           print "no param or upload data\n";
  
  
  

Mime
View raw message