Joe Orton wrote:
On Fri, Feb 07, 2003 at 06:04:29PM +1100, Stas Bekman wrote:

William A. Rowe, Jr. wrote:

AHHH... you are confusing apr/test (Ryan's ongoing efforts, even apart

from the apr group) which tests internal functions, with perl-testsuite,

which tests behavior of the server.

If Joe's tests work - commit them :-)

I don't have php installed. Preferrably, someone who can test them first, will commit them. Otherwise I can commit without testing, though they need some cleanup (use hardcoded / path separator is not crossplatform)...


OK - is there some easy way to make this portable? The only other places
I can find which use local files seem to be doing the same thing,
though: modules/cgi.t with $cgi_log and write_htaccess in modules/dir.t?

There are many more tests in the modperl-2.0 repository. And there is also an extensive doc http://perl.apache.org/docs/general/testing/testing.html


To make things portable in Perl you have to use File::Spec.

use File::Spec::Functions qw(catfile);
my $docroot = $vars->{documentroot};
my $fname = catfile $docroot, "php", "getlastmod.php";

Though of course you don't want to use catfile for generating URLs, because there are always Unix way and "/php/getlastmod.php" is correct.

Finally, rather than using:

printf "# debug: month is %s\n", $month;

Apache::TestUtil imports t_debug(), so you just need to say:

t_debug("month is $month");

But we want the verbosity mode to be automatically enabled and disabled from the command line, so we use another utility: t_cmp

and we end up with:

ok t_cmp($result, $month, "testing modification month");

when you run the test suite with -v:

% t/TEST -v php/getlastmod

you will get the verbose debug information, so you don't need to add any extra debugging statements.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Reply via email to