httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject t/modules/rewrite tweaking
Date Tue, 07 Aug 2001 06:13:35 GMT
perl t/TEST httpd /home/stas/httpd-2.0/bin/httpd -run t/modules/rewrite.t
modules/rewrite.....NOK 6Invalid [] range ">-6" before HERE mark in regex
m/^[<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /modules/rewrite/1 was not found on this server.</p>
</body></html>-6 << HERE ]$/
modules/rewrite.....dubious
	Test returned status 9 (wstat 2304, 0x900)
DIED. FAILED tests 1-27
	Failed 27/27 tests, 0.00% okay
Failed Test       Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
modules/rewrite.t    9  2304    27   27 100.00%  1-27
error running tests (please examine t/logs/error_log)
Failed 1/1 test scripts, 0.00% okay. 27/27 subtests failed, 0.00% okay.

the problem is in "Invalid [] range ">-6" before HERE mark in regex" at
least that's what I see with perl   5.6.1.

If - is not a range (which apparently it's not), you should escape it:

Index: t/modules/rewrite.t
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/t/modules/rewrite.t,v
retrieving revision 1.1
diff -u -r1.1 rewrite.t
--- t/modules/rewrite.t	2001/08/02 16:38:19	1.1
+++ t/modules/rewrite.t	2001/08/07 05:54:43
@@ -25,7 +25,7 @@
 		chomp $r;

 		if ($_ eq 'RND') {
-			ok ($r =~ /^[$r-6]$/);
+			ok ($r =~ /^[$r\-6]$/);
 		} else {
 			ok ($r eq $n);
 		}

Also I've applied the 4 chars indent convention that we use (let me know
if you don't care, so here is a complete patch:

Index: t/modules/rewrite.t
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/t/modules/rewrite.t,v
retrieving revision 1.1
diff -u -r1.1 rewrite.t
--- t/modules/rewrite.t	2001/08/02 16:38:19	1.1
+++ t/modules/rewrite.t	2001/08/07 05:51:15
@@ -16,20 +16,20 @@
 plan tests => @map * @num + 3;

 foreach (@map) {
-	foreach my $n (@num) {
-		## throw $_ into upper case just so we can test out internal
-		## 'tolower' map in mod_rewrite
-		$_=uc($_);
+    foreach my $n (@num) {
+        ## throw $_ into upper case just so we can test out internal
+        ## 'tolower' map in mod_rewrite
+        $_ = uc($_);

-		$r = GET_BODY "/modules/rewrite/$n", 'Accept' => $_;
-		chomp $r;
+        $r = GET_BODY "/modules/rewrite/$n", 'Accept' => $_;
+        chomp $r;

-		if ($_ eq 'RND') {
-			ok ($r =~ /^[$r-6]$/);
-		} else {
-			ok ($r eq $n);
-		}
-	}
+        if ($_ eq 'RND') {
+            ok ($r =~ /^[$r\-6]$/);
+        } else {
+            ok ($r eq $n);
+        }
+    }
 }

 $r = GET_BODY "/modules/rewrite/", 'Accept' => 7;



note that all sub-tests in this test file are failing for me, with the
latest apache built as:

make distclean
./buildconf
./configure --prefix=$HOME/httpd-2.0 \
   --with-mpm=threaded --enable-so \
   --enable-rewrite=shared
make && make install

[Tue Aug 07 14:09:00 2001] [error] [client 127.0.0.1] File does not exist:
/home/stas/apache.org/httpd-test/perl-framework/t/htdocs/modules/rewrite/6
[Tue Aug 07 14:09:01 2001] [error] [client 127.0.0.1] Directory index
forbidden by rule:
/home/stas/apache.org/httpd-test/perl-framework/t/htdocs/modules/rewrite/

another important IMHO note is to test whether the feature under test is
enabled and perform the skip operation if not, rather then report failure.
In addition during the skip, you can print a note, how to add the missing
feature.

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/





Mime
View raw message