On Fri, Aug 30, 2002 at 05:54:15PM +1000, Ken Williams wrote:
> Oh, one big lib/, not several different ones?  So then why can't it be 
> run with
> 
>  perl -Mblib=lib t/foo/bar.t
> 
> ?

Because tests all try to run from t/.  That's what the chdir 't' is for.
t/TEST does this for you and so do the tests themselves which makes it much
more forgiving.  Otherwise it would be very picky and this:

    $ cd /path/to/src/perl
    $ ./perl -Ilib t/foo/bar.t

wouldn't work when you ran a test manually.  You'd have to do:

    $ cd /path/to/src/perl/t
    $ ./perl -I../lib foo/bar.t

and always remember to run from t/.


> I'm just trying to push the decision into a more appropriate place, 
> though I guess in the end it's not such a big deal.

This is already effectively done by the TestInit module but nobody trusts
it.  t/TEST will run each test with -MTestInit.  t/harness does not so that
will have to be somehow fixed.

I usually do exactly that when I run them manually:

    ./perl -Ilib lib/Foo/whatever.t.

but that -Ilib isn't really necessary since the test does it.  If we remove
the BEGIN block code and place that elsewhere things get more complicated
when trying to run an individual test:

    ./perl -It -MTestInit lib/Foo/whatever.t

or

    ./perl -I. -MTestInit ../lib/Foo/whatever.t


What it boils down to is how to you remove the need for the cargo-cult BEGIN
block in each test while still making it easy to run individual tests by
hand?


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl Quality Assurance      <[EMAIL PROTECTED]>         Kwalitee Is Job One
Tasty, yet morally ambiguous.

Reply via email to