summaryrefslogtreecommitdiff
path: root/TestInit.pm
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-02-07 15:36:40 +0000
committerNicholas Clark <nick@ccl4.org>2011-02-07 16:33:12 +0000
commit76cc22ec8d16738e37cbdd3bb7205aed330bd0e7 (patch)
treeb8c715f4bf1f881b4633e59ce158848c2cb82490 /TestInit.pm
parentbe2b6a899980e0f4af70e797c0fdaeec6dd6a7d9 (diff)
downloadperl-76cc22ec8d16738e37cbdd3bb7205aed330bd0e7.tar.gz
When running tests from lib/, set @INC and $ENV{PERL5LIB} to ../lib
This ensures (reasonable) consistency with tests in cpan/, dist/ and ext/, which set this to qw(../../lib ../../t), but are not from t/, hence don't have t/ implicitly in @INC as '.'
Diffstat (limited to 'TestInit.pm')
-rw-r--r--TestInit.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/TestInit.pm b/TestInit.pm
index 8513955ab7..a113554068 100644
--- a/TestInit.pm
+++ b/TestInit.pm
@@ -18,7 +18,7 @@
package TestInit;
-$VERSION = 1.02;
+$VERSION = 1.03;
# Let tests know they're running in the perl core. Useful for modules
# which live dual lives on CPAN.
@@ -69,6 +69,7 @@ if (-f 't/TEST' && -f 'MANIFEST' && -d 'lib' && -d 'ext') {
} else {
chdir 't' or die "Can't chdir 't': $!";
new_inc('../lib');
+ set_opt('../lib') if $0 =~ m!^lib/!;
}
} else {
new_inc('../lib');
@@ -80,6 +81,8 @@ sub import {
foreach (@_) {
if ($_ eq 'U2T') {
@new_inc = @up_2_t;
+ } elsif ($_ eq 'U1') {
+ @new_inc = '../lib';
} elsif ($_ eq 'NC') {
delete $ENV{PERL_CORE}
} elsif ($_ eq 'A') {