[EMAIL PROTECTED] 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:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



Reply via email to