Bootstrap test fixes.
Dan Brook [Sun, 31 Oct 2010 17:59:58 +0000 (17:59 +0000)]
The author tests were failing in a bootstrapped environment as the env
script only looked at the current or the parent directory for
local-lib5. Also fixed the POD tests to look under lib so as to avoid
trawling local-lib5 for unrelated modules.

Fixed the tag and head tests to make use of env.

.gitignore
script/env
t/02git_head.t
t/02git_tag.t
t/author/notabs.t
t/author/pod.t
t/author/podcoverage.t

index d939243..2dae08f 100644 (file)
@@ -15,3 +15,5 @@ MANIFEST.bak
 *~
 .#*
 *#
+local-lib5/*
+*.orig
index 7f96991..cfa7493 100755 (executable)
@@ -30,14 +30,25 @@ use warnings;
 use Carp;
 use lib;
 use FindBin;
+use File::Spec ();
 
-my $basedir;
-if (-r "$FindBin::Bin/Makefile.PL") {
-    $basedir = $FindBin::Bin;
-}
-elsif (-r "$FindBin::Bin/../Makefile.PL") {
-    $basedir = "$FindBin::Bin/..";
-}
+# Look up to see find Makefile.PL aka the base of the local::lib install.
+my $lookup; $lookup = sub {
+    my $dir = $_[0] || '.';
+
+    my(undef, $dirbit) = File::Spec->splitpath($FindBin::Bin);
+    my $trydir         = File::Spec->catdir($dirbit, $dir);
+
+    return '' unless -d $trydir;
+
+    my $tryfile = File::Spec->catfile($trydir, "Makefile.PL");
+
+    return $trydir if -r $tryfile;
+
+    return $lookup->( File::Spec->catdir($dir, File::Spec->updir) );
+};
+
+my $basedir = $lookup->();
 
 $basedir ||= '';
 my $target = "$basedir/local-lib5";
index be92102..8c6ffdd 100644 (file)
@@ -1,3 +1,11 @@
+use FindBin qw/$Bin/;
+BEGIN {
+    my $env = "$FindBin::Bin/../script/env";
+    if (-r $env) {
+        do $env or die $@;
+    }
+}
+
 use strict;
 use warnings;
 use Test::More qw/no_plan/;
index 3647cb1..baa9983 100644 (file)
@@ -1,3 +1,10 @@
+use FindBin qw/$Bin/;
+BEGIN {
+    my $env = "$FindBin::Bin/../script/env";
+    if (-r $env) {
+        do $env or die $@;
+    }
+}
 use strict;
 use warnings;
 use Test::More qw/no_plan/;
index 693e048..004c15f 100644 (file)
@@ -1,3 +1,10 @@
+use FindBin qw/$Bin/;
+BEGIN {
+    my $env = "$FindBin::Bin/../../script/env";
+    if (-r $env) {
+        do $env or die $@;
+    }
+}
 use Test::NoTabs;
 all_perl_files_ok(qw(t lib));
 
index 3c6d16f..6b914af 100644 (file)
@@ -1,8 +1,16 @@
 #!/usr/bin/env perl
+use FindBin qw/$Bin/;
+BEGIN {
+    my $env = "$FindBin::Bin/../../script/env";
+    if (-r $env) {
+        do $env or die $@;
+    }
+}
+
 use strict;
 use warnings;
 use Test::More;
 
 use Test::Pod 1.14;
 
-all_pod_files_ok();
+all_pod_files_ok( all_pod_files('lib') );
index 1e43732..7cb9f58 100644 (file)
@@ -1,14 +1,21 @@
-#!/usr/bin/env perl
+use FindBin qw/$Bin/;
+BEGIN {
+    my $env = "$FindBin::Bin/../../script/env";
+    if (-r $env) {
+        do $env or die $@;
+    }
+}
+
 use strict;
 use warnings;
 use Test::More;
 
 use Test::Pod::Coverage 1.04;
 
-all_pod_coverage_ok({
+pod_coverage_ok($_,  {
     also_private => [qw/
         BUILD
         BUILDARGS
         build_per_context_instance
     /],
-});
+}) for all_modules('lib');