httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john sachs <jsa...@covalent.net>
Subject Re: t/modules/expires.t .. expected?
Date Tue, 16 Oct 2001 22:13:06 GMT
hi,

On Tue, Oct 16, 2001 at 05:46:25PM -0400, Rodent of Unusual Size wrote:

+ expires_test() fails at the end if $actual != $expected.  So
+ I don't quite get how the first if-block sets expected
+ correctly:
+ 
+     my $expected = '';
+     my $exp_type = '';
+     if ($exp_conf =~ /^([A|M])(\d+)$/) {
+         $exp_type = $1;
+         $expected = $2;
+     } else {
+         print STDERR "\n\ndoom: $exp_conf\n\n";
+         return 0;
+     }
+ 
+     my $actual = 0;
+     if ($exp_type eq 'M') {
+         $actual = $headers{expires} - $headers{modified};
+     } elsif ($exp_type eq 'A') {
+         $actual = $headers{expires} - $headers{access};
+     }
+ 
+     print "debug: expected: $expected\n";
+     print "debug: actual  : $actual\n";
+     return ($actual == $expected);
+ 
+ I would think it would need to include
+ 
+ if ($exp_type eq 'A') {
+     $expected += $headers{access};
+ } else {
+     $expected += $headers{modified};
+ }

why?
expected is being set to whatever is in the config.
so if the config is A120, expected is 120 seconds.  so the difference between the acce3ss
header and the expires header should be 120 seconds.

     } elsif ($exp_type eq 'A') {
         $actual = $headers{expires} - $headers{access};

at that point $actual should be 120 if everything went smoothly.  your expected is already
set to 120 from

     if ($exp_conf =~ /^([A|M])(\d+)$/) {
         $exp_type = $1;
         $expected = $2;

if you did

     if ($exp_type eq 'A') {
         $expected += $headers{access};

$expected would be some wacky number (120 + whatever the access time was).
so i dont see how those three tests pass with that code added...

run t/TEST -v t/modules/expires.t
and paste the relevant debug output into a mail and i'll take a look...

-j

Mime
View raw message