Break out the code that finds tests in MANIFEST into _tests_from_manifest().
[p5sagit/p5-mst-13.2.git] / t / TestInit.pm
1 # This is a replacement for the old BEGIN preamble which heads (or
2 # should head) up every core test program to prepare it for running.
3 # Now instead of:
4 #
5 # BEGIN {
6 #   chdir 't' if -d 't';
7 #   @INC = '../lib';
8 # }
9 #
10 # Its primary purpose is to clear @INC so core tests don't pick up
11 # modules from an installed Perl.
12 #
13 # t/TEST will use -MTestInit.  You may "use TestInit" in the test
14 # programs but it is not required.
15 #
16 # P.S. This documentation is not in POD format in order to avoid
17 # problems when there are fundamental bugs in perl.
18
19 package TestInit;
20
21 $VERSION = 1.02;
22
23 chdir 't' if -f 't/TestInit.pm';
24
25 # Let tests know they're running in the perl core.  Useful for modules
26 # which live dual lives on CPAN.
27 # Don't interfere with the taintedness of %ENV, this could perturbate tests.
28 # This feels like a better solution than the original, from
29 # http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-07/msg00154.html
30 $ENV{PERL_CORE} = $^X;
31 if (${^TAINT}) {
32     @INC = '../lib';
33 } else {
34     @INC = ('../lib', '.');
35 }
36
37 $0 =~ s/\.dp$//; # for the test.deparse make target
38 1;
39