From: apeiron Date: Wed, 13 May 2009 00:53:03 +0000 (+0000) Subject: Additional install tests from Hans Dieter Pearcey (hdp@cpan.org). Thanks! X-Git-Tag: 1.006009~79 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=be160790d81b3298b2378a9a55960685be078c67;p=p5sagit%2Flocal-lib.git Additional install tests from Hans Dieter Pearcey (hdp@cpan.org). Thanks! git-svn-id: http://dev.catalyst.perl.org/repos/bast/local-lib/1.000/trunk@6242 bd8105ee-0ff8-0310-8827-fb3f25b6796d --- diff --git a/Changes b/Changes index 988b7e0..f31241a 100644 --- 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 . + Thanks! 1.003003 2009-04-09 - Expose the internals per RT #36846. diff --git a/lib/local/lib.pm b/lib/local/lib.pm index 94ed490..d2e5269 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -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 . Doc patches for a custom local::lib patch contributed by Torsten Raudssus . +Hans Dieter Pearcey 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 index 0000000..09cc2b9 --- /dev/null +++ b/t/dist/EUMM/Makefile.PL @@ -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 index 0000000..0afc604 --- /dev/null +++ b/t/dist/EUMM/lib/EUMM.pm @@ -0,0 +1 @@ +1; diff --git a/t/dist/MB/Build.PL b/t/dist/MB/Build.PL new file mode 100644 index 0000000..1b2aeb3 --- /dev/null +++ b/t/dist/MB/Build.PL @@ -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 index 0000000..8c80ba2 --- /dev/null +++ b/t/dist/MB/lib/MB.pm @@ -0,0 +1 @@ +our $VERSION = 1; 1; diff --git a/t/install.t b/t/install.t new file mode 100644 index 0000000..8c6727c --- /dev/null +++ b/t/install.t @@ -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", + ); +}