Additional install tests from Hans Dieter Pearcey (hdp@cpan.org). Thanks!
apeiron [Wed, 13 May 2009 00:53:03 +0000 (00:53 +0000)]
git-svn-id: http://dev.catalyst.perl.org/repos/bast/local-lib/1.000/trunk@6242 bd8105ee-0ff8-0310-8827-fb3f25b6796d

Changes
lib/local/lib.pm
t/dist/EUMM/Makefile.PL [new file with mode: 0644]
t/dist/EUMM/lib/EUMM.pm [new file with mode: 0644]
t/dist/MB/Build.PL [new file with mode: 0644]
t/dist/MB/lib/MB.pm [new file with mode: 0644]
t/install.t [new file with mode: 0644]

diff --git a/Changes b/Changes
index 988b7e0..f31241a 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,7 +1,11 @@
 Revision history for local::lib
 
-       - Additional documentation and examples concerning having multiple
-         local::lib enviornments (amiri)
+1.003004 2009-05-12
+        - Additional documentation and examples concerning having multiple
+          local::lib enviornments (amiri)
+
+        - Some install tests courtesy of Hans Dieter Pearcey <hdp@cpan.org>.
+          Thanks!
 
 1.003003 2009-04-09
         - Expose the internals per RT #36846.
index 94ed490..d2e5269 100644 (file)
@@ -11,7 +11,7 @@ use File::Path ();
 use Carp ();
 use Config;
 
-our $VERSION = '1.003003'; # 1.3.3
+our $VERSION = '1.003004'; # 1.3.4
 
 sub import {
   my ($class, @args) = @_;
@@ -613,6 +613,9 @@ documentation additions, contributed by Christopher Nehren <apeiron@cpan.org>.
 Doc patches for a custom local::lib patch contributed by Torsten Raudssus
 <torsten@raudssus.de>.
 
+Hans Dieter Pearcey <hdp@cpan.org> sent in some additional tests for ensuring
+things will install properly.
+
 =head1 LICENSE
 
 This library is free software under the same license as perl itself
diff --git a/t/dist/EUMM/Makefile.PL b/t/dist/EUMM/Makefile.PL
new file mode 100644 (file)
index 0000000..09cc2b9
--- /dev/null
@@ -0,0 +1,5 @@
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+  NAME => 'EUMM',
+);
diff --git a/t/dist/EUMM/lib/EUMM.pm b/t/dist/EUMM/lib/EUMM.pm
new file mode 100644 (file)
index 0000000..0afc604
--- /dev/null
@@ -0,0 +1 @@
+1;
diff --git a/t/dist/MB/Build.PL b/t/dist/MB/Build.PL
new file mode 100644 (file)
index 0000000..1b2aeb3
--- /dev/null
@@ -0,0 +1,6 @@
+use Module::Build;
+Module::Build->new(
+  module_name       => "MB",
+  dist_version      => 1,
+  license           => "perl",
+)->create_build_script;
diff --git a/t/dist/MB/lib/MB.pm b/t/dist/MB/lib/MB.pm
new file mode 100644 (file)
index 0000000..8c80ba2
--- /dev/null
@@ -0,0 +1 @@
+our $VERSION = 1; 1;
diff --git a/t/install.t b/t/install.t
new file mode 100644 (file)
index 0000000..8c6727c
--- /dev/null
@@ -0,0 +1,41 @@
+use strict;
+use warnings;
+use Test::More;
+BEGIN { plan skip_all => "Install Capture::Tiny to test installation"
+  unless eval { require Capture::Tiny; 1 } }
+use Capture::Tiny qw(capture);
+use File::Temp qw(tempdir);
+use File::Spec;
+use Cwd;
+use Config;
+
+plan tests => 2;
+
+my $dir = tempdir(DIR => Cwd::abs_path('t'), CLEANUP => 1);
+
+use local::lib ();
+local::lib->import($dir);
+
+my $orig_dir = cwd;
+SKIP: for my $dist_type (qw(EUMM MB)) {
+  chdir File::Spec->catdir($orig_dir, qw(t dist), $dist_type);
+  if ($dist_type eq 'EUMM') {
+    my ($stdout, $stderr) = capture { eval { 
+      system($^X, 'Makefile.PL') && die "Makefile.PL failed";
+      system($Config{make}, 'install') && die "$Config{make} install failed";
+    } };
+    diag $stdout, $stderr if $@;
+  } else {
+    my ($stdout, $stderr) = capture { eval {
+      system($^X, 'Build.PL') && die "Build.PL failed";
+      system($^X, 'Build', 'install') && die "Build install failed";
+    } };
+    diag $stdout, $stderr if $@;
+  }
+  ok(
+    -e File::Spec->catfile(
+      $dir, qw(lib perl5), "$dist_type.pm",
+    ),
+    "$dist_type.pm installed into the correct location",
+  );
+}