On Fri, Aug 30, 2002 at 11:57:16AM +0100, Nick Ing-Simmons wrote: > Michael G Schwern <[EMAIL PROTECTED]> writes: > >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 > >> > >> ? > > blib was invented to allow just such usage. > > > > >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: > > If you look at it you will see it tries to hunt down the right things > allowing for fact you may have chdir'ed into t (or even deeper).
It's not just getting @INC right. The tests must be run from t/ (ie. a canonical directory they're always run from) so that they can find certain files properly and so that they only scribble scratch files inside t/. For example, lib/Test/Simple/t/exit.t has to find some sample programs to test against in t/lib/Test/Simple/sample_tests. How can it find it if it doesn't know where it was run from? You have to get into things like looking at $0 and trying to walk your way up to the top level source directory. Icky. The existing t/TestInit.pm takes this into account by simply chdir'ing to t/. -- Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One I do have a cause though. It is obscenity. I'm for it. -- Tom Lehrer "Smut"