perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James G Smith <JGSm...@TAMU.Edu>
Subject Re: resolving Apache::Test vs. Apache::test collision
Date Tue, 06 May 2003 11:14:34 GMT
Stas Bekman <stas@stason.org> wrote:
>We have a problem with using the Apache::Test name, more correctly we have a 
>problem with using the Apache/Test.pm filename. On platforms with 
>case-insentive filesystems (winFU, Mac OS X) if mod_perl 1.x is installed, 
>there is Apache/test.pm (notice the lower case 't'). So when you say 'use 
>Apache::Test' it loads Apache::test. Boom, nothing works.
>
>There are several routes we can take to resolve this problem:
>
>1. rename Apache::Test to something else. David Wheeler has proposed to use 
>Apache::Tester (or even swap the sides: Test::Apache).

As much work as it would require at this point (going through and
changing all the package names, renaming files, munging CVS), I think
Test::Apache would fit in better.

What convinced me of this was a look at my test code.  At the top, ignoring
the code to test for availability, I basically have (under the new name):

    use Test::Apache qw(plan have ok skip);
    use Test::Apache::Request qw(GET);
    
    plan tests => $some_number, have 'LWP';

    # rest of tests here

    __END__


In my non-Apache modules, I have:

    use Test::More;

    plan tests => $some_number;

    # rest of tests here

    __END__


There's a nice symmetry here.


Of course, I had to go and try combining the two :)   They seem to
work.  I am able to use Test::More to plan and report testing while I
use Apache::TestRequest to do the fetching.  This undercuts a little
the argument for Test::Apache being the better name.  We still need
the Apache::TestRequest version of GET because it knows where the
test server is.

    use Test::More;

    BEGIN {
        eval {
            require Apache::TestRequest;
            Apache::TestRequest -> import(qw(GET));
        };
    }

    my @required = qw(
        Apache::Test 
        Apache::TestRequest
        DBD::CSV 
        HTML::Mason 
        LWP 
    );
    my @unavailable;
    if(@unavailable = grep { ! eval "require $_" } @required) {
        plan skip_all => "The following modules are unavailable: " 
                         . join(" ", @unavailable);
        exit 0;
    }

    plan tests => 1;

    my $res = GET "/mason/test1.html";
    ok $res->content eq '[This is a Mason Page]
    ';

    exit 0;

    __END__

-- 
James Smith <JGSmith@TAMU.Edu>, 979-862-3725
Texas A&M CIS Operating Systems Group, Unix

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message