Break out the code that finds tests in MANIFEST into _tests_from_manifest().
[p5sagit/p5-mst-13.2.git] / t / TestInit.pm
index 058ad29..637cfec 100644 (file)
@@ -7,6 +7,9 @@
 #   @INC = '../lib';
 # }
 #
+# Its primary purpose is to clear @INC so core tests don't pick up
+# modules from an installed Perl.
+#
 # t/TEST will use -MTestInit.  You may "use TestInit" in the test
 # programs but it is not required.
 #
 
 package TestInit;
 
-$VERSION = 1.01;
+$VERSION = 1.02;
 
-chdir 't' if -d 't';
-if ($^O eq 'VMS') {
-    require File::Spec;
-    @INC = File::Spec->rel2abs('[-.lib]');
-}
-else {
+chdir 't' if -f 't/TestInit.pm';
+
+# Let tests know they're running in the perl core.  Useful for modules
+# which live dual lives on CPAN.
+# Don't interfere with the taintedness of %ENV, this could perturbate tests.
+# This feels like a better solution than the original, from
+# http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-07/msg00154.html
+$ENV{PERL_CORE} = $^X;
+if (${^TAINT}) {
     @INC = '../lib';
+} else {
+    @INC = ('../lib', '.');
 }
 
-# Don't interfere with the taintedness of %ENV, this could perturbate tests
-$ENV{PERL_CORE} = 1 unless ${^TAINT};
-
 $0 =~ s/\.dp$//; # for the test.deparse make target
 1;