You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@apache.org on 2001/06/27 07:36:53 UTC
cvs commit: modperl-2.0/t/response/TestModules cgi.pm
dougm 01/06/26 22:36:53
Modified: t/modules cgi.t
t/response/TestModules cgi.pm
Log:
beef up the cgi.pm test a bit
Revision Changes Path
1.4 +3 -5 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- cgi.t 2001/05/08 21:08:42 1.3
+++ cgi.t 2001/06/27 05:36:51 1.4
@@ -13,15 +13,13 @@
my $res = GET "$location?PARAM=2";
my $str = $res->content;
-print $str;
+ok $str eq "ok 2\n" or print "str=$str";
$str = POST_BODY $location, content => 'PARAM=%33';
-print $str;
+ok $str eq "ok 3\n" or print "str=$str";
$str = UPLOAD_BODY $location, content => 4;
-print $str;
-
-$Test::ntest += 3;
+ok $str eq "ok 4\n" or print "str=$str";
ok $res->header('Content-type') =~ m:^text/test-output:;
1.5 +14 -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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- cgi.pm 2001/05/08 21:08:49 1.4
+++ cgi.pm 2001/06/27 05:36:52 1.5
@@ -9,6 +9,14 @@
sub handler {
my $r = shift;
+ if ($CGI::Q) {
+ die "CGI.pm globals were not reset";
+ }
+
+ unless ($CGI::MOD_PERL) {
+ die "CGI.pm does not think this is mod_perl";
+ }
+
my $cgi = CGI->new;
my $param = $cgi->param('PARAM');
@@ -17,13 +25,17 @@
print $cgi->header('-type' => 'text/test-output',
'-X-Perl-Module' => __PACKAGE__);
- print "ok $param\n" if $param;
-
if ($httpupload) {
no strict;
local $/;
my $content = <$httpupload>;
print "ok $content\n";
+ }
+ elsif ($param) {
+ print "ok $param\n";
+ }
+ else {
+ print "no param or upload data\n";
}
Apache::OK;