Add an import option 'T' to TestInit, for tests that run at the top level.
authorNicholas Clark <nick@ccl4.org>
Sun, 19 Jun 2011 17:39:07 +0000 (19:39 +0200)
committerNicholas Clark <nick@ccl4.org>
Wed, 22 Jun 2011 20:41:13 +0000 (22:41 +0200)
This sets @INC to 'lib, and unless we're already at the top level will
chdir '..' [on the assumption that we are starting in t].

TestInit.pm

index 88c3ba1..c921686 100644 (file)
@@ -69,6 +69,11 @@ sub import {
            delete $ENV{PERL_CORE}
        } elsif ($_ eq 'A') {
            $abs = 1;
+       } elsif ($_ eq 'T') {
+           $chdir = '..'
+               unless -f 't/TEST' && -f 'MANIFEST' && -d 'lib' && -d 'ext';
+           @new_inc = 'lib';
+           $setopt = 1;
        } else {
            die "Unknown option '$_'";
        }