You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by Stas Bekman <st...@stason.org> on 2001/11/22 03:04:35 UTC
Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestCommon.pm
dougm@apache.org wrote:
> dougm 01/11/21 12:59:23
>
> Added: perl-framework/Apache-Test/lib/Apache TestCommon.pm
> Log:
> new module for common tests that are run from more than 1 .t file
isn't it "common" only for httpd-test, but not really common for other
projects using Apache-Test, e.g. mod_perl comes to mind.
The reason I ask is that gozer has suggested to have a similar thing for
mod_perl stuff. For example he saw that many methods that are based on
apr_table_t have identical tests, so he suggested to write a common test
and remove duplication from tests. But than you have already taken
TestCommon here.
I think these should live outside Apache-Test, somewhere under t/
specific to each project. For example t/lib/common.pm.
here's gozer's request:
Philippe M. Chiasson wrote:
Hey, I am tired of writing test for all sort of things that behave
like hash and set/get things
$r->method() returns a hash
$r->method('key') returns the value
$r->method('key','value') sets the value and returns the value
bla bla bla...
Where should I put something like this :
sub test_hashish {
my ($hash,$name) = @_;
ok $hash->$name;
ok UNIVERSAL::isa($hash->$name,'HASH');
ok t_cmp("${name}_bar", $hash->$name("${name}_foo","${name}_bar"),
qq{\$hash->$name(key,val)});
ok t_cmp("${name}_bar", $hash->$name("${name}_foo") ,
qq{\$hash->$name(key)}); ok t_cmp("${name}_bar",
$hash->$name()->{"${name}_foo"}, qq{\$hash->$name()->{key}});
[...]
}
so you can simply do
test_hashish($r,'pnotes');
test_hashish($r,'headers_in');
test_hashihs($r,'headers_out');
_____________________________________________________________________
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://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache
TestCommon.pm
Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 22 Nov 2001, Stas Bekman wrote:
> isn't it "common" only for httpd-test, but not really common for other
> projects using Apache-Test, e.g. mod_perl comes to mind.
nope. Apache::TestCommon::run_write_test could also be used against
mod_perl, php, java, python, ssi, cgi, or anything that can generate
dynamic content.
> The reason I ask is that gozer has suggested to have a similar thing for
> mod_perl stuff. For example he saw that many methods that are based on
> apr_table_t have identical tests, so he suggested to write a common test
> and remove duplication from tests. But than you have already taken
> TestCommon here.
>
> I think these should live outside Apache-Test, somewhere under t/
> specific to each project. For example t/lib/common.pm.
that would be fine for common things specific to modperl.