From: Olivier Mengué Date: Sun, 1 May 2011 04:20:43 +0000 (+0200) Subject: Test for no arch in PERL5LIB X-Git-Tag: 1.008008~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b4d420efb8cd1cc7c108154d9cf569941c394aae;p=p5sagit%2Flocal-lib.git Test for no arch in PERL5LIB RT#67871: "do not add arch path to PERL5LIB: perl does it since 5.8.0" --- diff --git a/t/stackable.t b/t/stackable.t index 6029a3a..ab6263b 100644 --- a/t/stackable.t +++ b/t/stackable.t @@ -2,9 +2,12 @@ use strict; use warnings; use Test::More; use File::Temp qw(tempdir); +use File::Spec; use Cwd; +use Config; +use Carp::Always; -plan tests => 19; +plan tests => 24; use local::lib (); @@ -26,12 +29,19 @@ sub mk_temp_dir my $dir1 = mk_temp_dir('test_local_lib-XXXXX'); my $dir2 = mk_temp_dir('test_local_lib-XXXXX'); +my ($dir1_arch, $dir2_arch) = map { File::Spec->catfile($_, qw'lib perl5', $Config{archname}) } $dir1, $dir2; +note $dir1_arch; +note $dir2_arch; + + my $prev_active = () = local::lib->active_paths; local::lib->import($dir1); is +() = local::lib->active_paths, $prev_active + 1, 'one active path'; like $ENV{PERL_LOCAL_LIB_ROOT}, qr/\Q$dir1/, 'added one dir in root'; like $ENV{PERL5LIB}, qr/\Q$dir1/, 'added one dir in lib'; +note $ENV{PERL5LIB}; +unlike $ENV{PERL5LIB}, qr/\Q$dir1_arch/, 'no arch in PERL5LIB'; like $ENV{PERL_MM_OPT}, qr/\Q$dir1/, 'first path is installation target'; local::lib->import($dir1); @@ -41,8 +51,10 @@ local::lib->import($dir2); is +() = local::lib->active_paths, $prev_active + 2, 'two active paths'; like $ENV{PERL_LOCAL_LIB_ROOT}, qr/\Q$dir2/, 'added another dir in root'; like $ENV{PERL5LIB}, qr/\Q$dir2/, 'added another dir in lib'; +unlike $ENV{PERL5LIB}, qr/\Q$dir2_arch/, 'no arch in PERL5LIB'; like $ENV{PERL_LOCAL_LIB_ROOT}, qr/\Q$dir1/, 'first dir is still in root'; like $ENV{PERL5LIB}, qr/\Q$dir1/, 'first dir is still in lib'; +unlike $ENV{PERL5LIB}, qr/\Q$dir1_arch/, 'no arch in PERL5LIB'; like $ENV{PERL_MM_OPT}, qr/\Q$dir2/, 'second path is installation target'; local::lib->import($dir1); @@ -54,6 +66,8 @@ like $ENV{PERL_MM_OPT}, qr/\Q$dir1/, 'first path is installation target again'; local::lib->import('--deactivate', $dir2); unlike $ENV{PERL_LOCAL_LIB_ROOT}, qr/\Q$dir2/, 'second dir was removed from root'; unlike $ENV{PERL5LIB}, qr/\Q$dir2/, 'second dir was removed from lib'; +unlike $ENV{PERL5LIB}, qr/\Q$dir2_arch/, 'no arch in PERL5LIB'; like $ENV{PERL_LOCAL_LIB_ROOT}, qr/\Q$dir1/, q{first dir didn't go away from root}; like $ENV{PERL5LIB}, qr/\Q$dir1/, q{first dir didn't go away from lib}; +unlike $ENV{PERL5LIB}, qr/\Q$dir1_arch/, 'no arch in PERL5LIB'; like $ENV{PERL_MM_OPT}, qr/\Q$dir1/, 'first dir stays installation target';