[Module-build-checkins] Module-Build/t destinations.t,1.4,1.5
Status: Beta
Brought to you by:
kwilliams
|
From: Ken W. <kwi...@us...> - 2005-06-20 18:23:09
|
Update of /cvsroot/module-build/Module-Build/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5848/t Modified Files: destinations.t Log Message: Refactor, and just check to make sure --prefix stays within the specified path Index: destinations.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/destinations.t,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- destinations.t 19 Jun 2005 13:55:45 -0000 1.4 +++ destinations.t 20 Jun 2005 18:22:35 -0000 1.5 @@ -9,10 +9,12 @@ use Config; use File::Spec::Functions qw( catdir ); -#use File::Spec; -# -#my $common_pl = File::Spec->catfile('t', 'common.pl'); -#require $common_pl; +use File::Spec; + +BEGIN { + my $common_pl = File::Spec->catfile('t', 'common.pl'); + require $common_pl; +} ok( $INC{'Module/Build.pm'}, '/blib/', "Make sure Module::Build was loaded from blib/"); @@ -64,32 +66,14 @@ ok( $m->{properties}{prefix} eq $prefix ); my $c = \%Config; -my $site_paths = $m->install_sets->{site}; - -my $naive_prefix = sub { - my ($path) = @_; - my $drive = ($path =~ s/^(\w:)// ? $1 : ''); # Win32 drive letters - (my $bare = $path) =~ s!^\Q$site_prefix\E\b!!; - return catdir($drive . $prefix, $bare); -}; - -ok( $m->install_destination( 'lib' ), - $naive_prefix->($site_paths->{lib}) ); - -ok( $m->install_destination( 'arch' ), - $naive_prefix->($site_paths->{arch}) ); - -ok( $m->install_destination( 'bin' ), - $naive_prefix->($site_paths->{bin}) ); - -ok( $m->install_destination( 'script' ), - $naive_prefix->($site_paths->{script}) ); -ok( $m->install_destination( 'bindoc' ), - $naive_prefix->($site_paths->{bindoc}) ); +test_prefix('lib'); +test_prefix('arch'); +test_prefix('bin'); +test_prefix('script'); +test_prefix('bindoc'); +test_prefix('libdoc'); -ok( $m->install_destination( 'libdoc' ), - $naive_prefix->($site_paths->{libdoc})); $m->install_base( $install_base ); @@ -100,3 +84,15 @@ ok( $m->install_destination( 'bindoc' ), catdir( $install_base, 'man', 'man1') ); ok( $m->install_destination( 'libdoc' ), catdir( $install_base, 'man', 'man3' ) ); +sub test_prefix { + my ($type) = @_; + + my $dest = $m->install_destination( $type ); + unless ($dest) { + skip_subtest("No target install location for type '$type'"); + return; + } + + ok( $dest, "/^\Q$prefix\E/"); +} + |