summaryrefslogtreecommitdiff
path: root/t/properties
diff options
context:
space:
mode:
Diffstat (limited to 't/properties')
-rw-r--r--t/properties/dist_suffix.t33
-rw-r--r--t/properties/license.t66
-rw-r--r--t/properties/module_name.t57
-rw-r--r--t/properties/needs_compiler.t125
-rw-r--r--t/properties/release_status.t204
-rw-r--r--t/properties/requires.t54
-rw-r--r--t/properties/share_dir.t257
7 files changed, 796 insertions, 0 deletions
diff --git a/t/properties/dist_suffix.t b/t/properties/dist_suffix.t
new file mode 100644
index 0000000..aaee112
--- /dev/null
+++ b/t/properties/dist_suffix.t
@@ -0,0 +1,33 @@
+# sample.t -- a sample test file for Module::Build
+
+use strict;
+use lib 't/lib';
+use MBTest;
+use DistGen;
+
+plan tests => 2;
+
+# Ensure any Module::Build modules are loaded from correct directory
+blib_load('Module::Build');
+
+#--------------------------------------------------------------------------#
+# Create test distribution
+#--------------------------------------------------------------------------#
+
+use DistGen;
+my $dist = DistGen->new( name => 'Simple::Name' );
+
+$dist->change_build_pl(
+ module_name => 'Simple::Name',
+ dist_suffix => 'SUFFIX',
+)->regen;
+
+$dist->chdir_in;
+
+my $mb = $dist->new_from_context();
+isa_ok( $mb, "Module::Build" );
+is( $mb->dist_dir, "Simple-Name-0.01-SUFFIX",
+ "dist_suffix set correctly"
+);
+
+# vim:ts=2:sw=2:et:sta:sts=2
diff --git a/t/properties/license.t b/t/properties/license.t
new file mode 100644
index 0000000..bb7247e
--- /dev/null
+++ b/t/properties/license.t
@@ -0,0 +1,66 @@
+use strict;
+use lib 't/lib';
+use MBTest;
+use DistGen;
+
+plan 'no_plan';
+
+# Ensure any Module::Build modules are loaded from correct directory
+blib_load('Module::Build');
+
+#--------------------------------------------------------------------------#
+# Create test distribution
+#--------------------------------------------------------------------------#
+
+{
+ my $dist = DistGen->new(
+ name => 'Simple::Name',
+ version => '0.01',
+ license => 'perl'
+ );
+
+ $dist->regen;
+ $dist->chdir_in;
+
+ my $mb = $dist->new_from_context();
+ isa_ok( $mb, "Module::Build" );
+ is( $mb->license, 'perl',
+ "license 'perl' is valid"
+ );
+
+ my $meta = $mb->get_metadata( fatal => 0 );
+
+ is_deeply( $meta->{license} => [ 'perl_5' ], "META license will be 'perl'" );
+ is_deeply( $meta->{resources}{license}, [ "http://dev.perl.org/licenses/" ],
+ "META license URL is correct"
+ );
+
+}
+
+{
+ my $dist = DistGen->new(
+ name => 'Simple::Name',
+ version => '0.01',
+ license => 'VaporWare'
+ );
+
+ $dist->regen;
+ $dist->chdir_in;
+
+ my $mb = $dist->new_from_context();
+ isa_ok( $mb, "Module::Build" );
+ is( $mb->license, 'VaporWare',
+ "license 'VaporWare' is valid"
+ );
+
+ my $meta = $mb->get_metadata( fatal => 0 );
+
+ is_deeply( $meta->{license} => [ 'unrestricted' ], "META license will be 'unrestricted'" );
+ is_deeply( $meta->{resources}{license}, [ "http://example.com/vaporware/" ],
+ "META license URL is correct"
+ );
+
+}
+
+# Test with alpha number
+# vim:ts=2:sw=2:et:sta:sts=2
diff --git a/t/properties/module_name.t b/t/properties/module_name.t
new file mode 100644
index 0000000..69aec8e
--- /dev/null
+++ b/t/properties/module_name.t
@@ -0,0 +1,57 @@
+# sample.t -- a sample test file for Module::Build
+
+use strict;
+use lib 't/lib';
+use MBTest;
+use DistGen;
+
+plan tests => 4;
+
+# Ensure any Module::Build modules are loaded from correct directory
+blib_load('Module::Build');
+
+my $dist;
+
+#--------------------------------------------------------------------------#
+# try getting module_name from dist_name
+#--------------------------------------------------------------------------#
+
+$dist = DistGen->new(
+ name => "Not::So::Simple",
+ distdir => 'Random-Name',
+)->chdir_in;
+
+$dist->change_build_pl(
+ dist_name => 'Not-So-Simple',
+ dist_version => 1,
+)->regen;
+
+my $mb = $dist->new_from_context();
+isa_ok( $mb, "Module::Build" );
+is( $mb->module_name, "Not::So::Simple",
+ "module_name guessed from dist_name"
+);
+
+#--------------------------------------------------------------------------#
+# Try getting module_name from dist_version_from
+#--------------------------------------------------------------------------#
+
+$dist->add_file( 'lib/Simple/Name.pm', << 'END_PACKAGE' );
+package Simple::Name;
+our $VERSION = 1.23;
+1;
+END_PACKAGE
+
+$dist->change_build_pl(
+ dist_name => 'Random-Name',
+ dist_version_from => 'lib/Simple/Name.pm',
+ dist_abstract => "Don't complain about missing abstract",
+)->regen( clean => 1 );
+
+$mb = $dist->new_from_context();
+isa_ok( $mb, "Module::Build" );
+is( $mb->module_name, "Simple::Name",
+ "module_name guessed from dist_version_from"
+);
+
+# vim:ts=2:sw=2:et:sta:sts=2
diff --git a/t/properties/needs_compiler.t b/t/properties/needs_compiler.t
new file mode 100644
index 0000000..f616dfc
--- /dev/null
+++ b/t/properties/needs_compiler.t
@@ -0,0 +1,125 @@
+# sample.t -- a sample test file for Module::Build
+
+use strict;
+use lib 't/lib';
+use MBTest;
+use DistGen;
+
+plan tests => 19;
+
+# Ensure any Module::Build modules are loaded from correct directory
+blib_load('Module::Build');
+
+my $dist = DistGen->new->regen->chdir_in;
+
+# get a Module::Build object and test with it
+my $mb;
+stderr_of(sub {
+ ok( $mb = $dist->new_from_context, "Default Build.PL" );
+});
+
+ok( ! $mb->needs_compiler, "needs_compiler is false" );
+ok( ! exists $mb->{properties}{build_requires}{'ExtUtils::CBuilder'},
+ "ExtUtils::CBuilder is not in build_requires"
+);
+
+#--------------------------------------------------------------------------#
+# try with c_source
+#--------------------------------------------------------------------------#
+$dist->change_build_pl({
+ module_name => $dist->name,
+ license => 'perl',
+ c_source => 'src',
+});
+$dist->regen;
+stderr_of(sub {
+ ok( $mb = $dist->new_from_context,
+ "Build.PL with c_source"
+ );
+});
+is( $mb->c_source, 'src', "c_source is set" );
+ok( $mb->needs_compiler, "needs_compiler is true" );
+ok( exists $mb->{properties}{build_requires}{'ExtUtils::CBuilder'},
+ "ExtUtils::CBuilder was added to build_requires"
+);
+
+#--------------------------------------------------------------------------#
+# try with xs files
+#--------------------------------------------------------------------------#
+$dist = DistGen->new(dir => 'MBTest', xs => 1);
+$dist->regen;
+$dist->chdir_in;
+
+stderr_of(sub {
+ ok( $mb = $dist->new_from_context,
+ "Build.PL with xs files"
+ );
+});
+ok( $mb->needs_compiler, "needs_compiler is true" );
+ok( exists $mb->{properties}{build_requires}{'ExtUtils::CBuilder'},
+ "ExtUtils::CBuilder was added to build_requires"
+);
+
+#--------------------------------------------------------------------------#
+# force needs_compiler off, despite xs modules
+#--------------------------------------------------------------------------#
+
+$dist->change_build_pl({
+ module_name => $dist->name,
+ license => 'perl',
+ needs_compiler => 0,
+});
+$dist->regen;
+
+stderr_of(sub {
+ ok( $mb = $dist->new_from_context ,
+ "Build.PL with xs files, but needs_compiler => 0"
+ );
+});
+is( $mb->needs_compiler, 0, "needs_compiler is false" );
+ok( ! exists $mb->{properties}{build_requires}{'ExtUtils::CBuilder'},
+ "ExtUtils::CBuilder is not in build_requires"
+);
+
+#--------------------------------------------------------------------------#
+# don't override specific EU::CBuilder build_requires
+#--------------------------------------------------------------------------#
+
+$dist->change_build_pl({
+ module_name => $dist->name,
+ license => 'perl',
+ build_requires => { 'ExtUtils::CBuilder' => 0.2 },
+});
+$dist->regen;
+
+stderr_of(sub {
+ ok( $mb = $dist->new_from_context ,
+ "Build.PL with xs files, build_requires EU::CB 0.2"
+ );
+});
+ok( $mb->needs_compiler, "needs_compiler is true" );
+is( $mb->build_requires->{'ExtUtils::CBuilder'}, 0.2,
+ "build_requires for ExtUtils::CBuilder is correct version"
+);
+
+#--------------------------------------------------------------------------#
+# falsify compiler and test error handling
+#--------------------------------------------------------------------------#
+
+# clear $ENV{CC} so we are sure to fail to find our fake compiler :-)
+local $ENV{CC};
+
+my $err = stderr_of( sub {
+ $mb = $dist->new_from_context( config => { cc => "adfasdfadjdjk" } )
+});
+ok( $mb, "Build.PL while hiding compiler" );
+like( $err, qr/no compiler detected/,
+ "hidden compiler resulted in warning message during Build.PL"
+);
+eval { $mb->dispatch('build') };
+like( $@, qr/no compiler detected/,
+ "hidden compiler resulted in fatal message during Build"
+);
+
+
+# vim:ts=2:sw=2:et:sta:sts=2
diff --git a/t/properties/release_status.t b/t/properties/release_status.t
new file mode 100644
index 0000000..45c7f33
--- /dev/null
+++ b/t/properties/release_status.t
@@ -0,0 +1,204 @@
+use strict;
+use lib 't/lib';
+use MBTest;
+use DistGen;
+
+if ( $] lt 5.008001 ) {
+ plan skip_all => "dotted-version numbers are buggy before 5.8.1";
+} else {
+ plan 'no_plan';
+}
+
+# Ensure any Module::Build modules are loaded from correct directory
+blib_load('Module::Build');
+
+#--------------------------------------------------------------------------#
+# Create test distribution
+#--------------------------------------------------------------------------#
+
+{
+ my $dist = DistGen->new( name => 'Simple::Name', version => '0.01' );
+
+ $dist->change_build_pl(
+ module_name => 'Simple::Name',
+ )->regen;
+
+ $dist->chdir_in;
+
+ my $mb = $dist->new_from_context();
+ isa_ok( $mb, "Module::Build" );
+ is( $mb->release_status, "stable",
+ "regular version has release_status 'stable'"
+ );
+}
+
+{
+ my $dist = DistGen->new( name => 'Simple::Name', version => 'v1.2.3' );
+
+ $dist->change_build_pl(
+ module_name => 'Simple::Name',
+ )->regen;
+
+ $dist->chdir_in;
+
+ my $mb = $dist->new_from_context();
+ isa_ok( $mb, "Module::Build" );
+ is( $mb->release_status, "stable",
+ "dotted-decimal version has release_status 'stable'"
+ );
+}
+
+{
+ my $dist = DistGen->new( name => 'Simple::Name', version => q{'0.01_01'} );
+
+ $dist->change_build_pl(
+ module_name => 'Simple::Name',
+ )->regen;
+
+ $dist->chdir_in;
+
+ my $mb = $dist->new_from_context();
+ isa_ok( $mb, "Module::Build" );
+ is( $mb->release_status, "testing",
+ "alpha version has release_status 'testing'"
+ );
+}
+
+{
+ my $dist = DistGen->new( name => 'Simple::Name', version => 'v1.2.3_1' );
+
+ $dist->change_build_pl(
+ module_name => 'Simple::Name',
+ )->regen;
+
+ $dist->chdir_in;
+
+ my $mb = $dist->new_from_context();
+ isa_ok( $mb, "Module::Build" );
+ is( $mb->release_status, "testing",
+ "dotted alpha version has release_status 'testing'"
+ );
+}
+
+{
+ my $dist = DistGen->new( name => 'Simple::Name', version => q{'0.01_01'} );
+
+ $dist->change_build_pl(
+ module_name => 'Simple::Name',
+ release_status => 'unstable',
+ )->regen;
+
+ $dist->chdir_in;
+
+ my $mb = $dist->new_from_context();
+ isa_ok( $mb, "Module::Build" );
+ is( $mb->release_status, "unstable",
+ "explicit 'unstable' keeps release_status 'unstable'"
+ );
+}
+
+{
+ my $dist = DistGen->new( name => 'Simple::Name', version => '0.01' );
+
+ $dist->change_build_pl(
+ module_name => 'Simple::Name',
+ release_status => 'testing',
+ )->regen;
+
+ $dist->chdir_in;
+
+ my $mb = $dist->new_from_context();
+ isa_ok( $mb, "Module::Build" );
+ is( $mb->dist_suffix, "TRIAL",
+ "regular version marked 'testing' gets 'TRIAL' suffix"
+ );
+}
+
+{
+ my $dist = DistGen->new( name => 'Simple::Name', version => 'v1.2.3' );
+
+ $dist->change_build_pl(
+ module_name => 'Simple::Name',
+ release_status => 'testing',
+ )->regen;
+
+ $dist->chdir_in;
+
+ my $mb = $dist->new_from_context();
+ isa_ok( $mb, "Module::Build" );
+ is( $mb->dist_suffix, "TRIAL",
+ "dotted version marked 'testing' gets 'TRIAL' suffix"
+ );
+}
+
+{
+ my $dist = DistGen->new( name => 'Simple::Name', version => '0.01' );
+
+ $dist->change_build_pl(
+ module_name => 'Simple::Name',
+ release_status => 'unstable',
+ )->regen;
+
+ $dist->chdir_in;
+
+ my $mb = $dist->new_from_context();
+ isa_ok( $mb, "Module::Build" );
+ is( $mb->dist_suffix, "TRIAL",
+ "regular version marked 'unstable' gets 'TRIAL' suffix"
+ );
+}
+
+{
+ my $dist = DistGen->new( name => 'Simple::Name', version => '0.01' );
+
+ $dist->change_build_pl(
+ module_name => 'Simple::Name',
+ release_status => 'beta',
+ )->regen;
+
+ $dist->chdir_in;
+
+ my $output = stdout_stderr_of sub { $dist->run_build_pl() };
+ like( $output, qr/Illegal value 'beta' for release_status/i,
+ "Got error message for illegal release_status"
+ );
+}
+
+{
+ my $dist = DistGen->new( name => 'Simple::Name', version => q{'0.01_01'} );
+
+ $dist->change_build_pl(
+ module_name => 'Simple::Name',
+ release_status => 'stable',
+ )->regen;
+
+ $dist->chdir_in;
+
+ my $output = stdout_stderr_of sub { $dist->run_build_pl() };
+ like( $output, qr/Illegal value 'stable' with version '0.01_01'/i,
+ "Got error message for illegal 'stable' with alpha version"
+ );
+}
+
+{
+ my $dist = DistGen->new( name => 'Simple::Name', version => q{'0.01_01'} );
+
+ $dist->change_build_pl(
+ module_name => 'Simple::Name',
+ dist_version => '1.23beta1',
+ )->regen;
+
+ $dist->chdir_in;
+
+ my $mb = $dist->new_from_context();
+ isa_ok( $mb, "Module::Build" );
+ is( $mb->dist_suffix, "",
+ "non-standard dist_version does not get a suffix"
+ );
+ is( $mb->release_status, "stable",
+ "non-standard dist_version defaults to stable release_status"
+ );
+}
+
+# Test with alpha number
+# vim:ts=2:sw=2:et:sta:sts=2
diff --git a/t/properties/requires.t b/t/properties/requires.t
new file mode 100644
index 0000000..6511e80
--- /dev/null
+++ b/t/properties/requires.t
@@ -0,0 +1,54 @@
+# sample.t -- a sample test file for Module::Build
+
+use strict;
+use lib 't/lib';
+use MBTest;
+use DistGen;
+
+plan tests => 4;
+
+# Ensure any Module::Build modules are loaded from correct directory
+blib_load('Module::Build');
+
+my ($dist, $mb, $prereqs);
+
+#--------------------------------------------------------------------------#
+# try undefined prereq version
+#--------------------------------------------------------------------------#
+
+$dist = DistGen->new( name => 'Simple::Requires' );
+
+$dist->change_build_pl(
+ module_name => 'Simple::Requires',
+ requires => {
+ 'File::Basename' => undef,
+ },
+)->regen;
+
+$dist->chdir_in;
+
+$mb = $dist->new_from_context();
+isa_ok( $mb, "Module::Build" );
+
+$prereqs = $mb->_normalize_prereqs;
+is($prereqs->{runtime}{requires}{'File::Basename'}, 0, "undef prereq converted to 0");
+
+#--------------------------------------------------------------------------#
+# try empty string prereq version
+#--------------------------------------------------------------------------#
+
+$dist->change_build_pl(
+ module_name => 'Simple::Requires',
+ requires => {
+ 'File::Basename' => '',
+ },
+)->regen;
+
+$mb = $dist->new_from_context();
+isa_ok( $mb, "Module::Build" );
+
+$prereqs = $mb->_normalize_prereqs;
+is($prereqs->{runtime}{requires}{'File::Basename'}, 0, "empty string prereq converted to 0");
+
+
+# vim:ts=2:sw=2:et:sta:sts=2
diff --git a/t/properties/share_dir.t b/t/properties/share_dir.t
new file mode 100644
index 0000000..f1cda13
--- /dev/null
+++ b/t/properties/share_dir.t
@@ -0,0 +1,257 @@
+#!/usr/bin/perl -w
+
+use strict;
+use lib 't/lib';
+use MBTest;
+use File::Spec::Functions qw/catdir catfile/;
+
+#--------------------------------------------------------------------------#
+# Begin testing
+#--------------------------------------------------------------------------#
+
+plan tests => 23;
+
+blib_load('Module::Build');
+
+#--------------------------------------------------------------------------#
+# Create test distribution
+#--------------------------------------------------------------------------#
+
+my $tmp = MBTest->tmpdir;
+
+use DistGen;
+my $dist = DistGen->new( dir => $tmp, name => 'Simple::Share' );
+$dist->regen;
+$dist->chdir_in;
+
+#--------------------------------------------------------------------------#
+# Test setting 'share_dir'
+#--------------------------------------------------------------------------#
+
+my $mb = $dist->new_from_context;
+
+# Test without a 'share' dir
+ok( $mb, "Created Module::Build object" );
+is( $mb->share_dir, undef,
+ "default share_dir undef if no 'share' dir exists"
+);
+ok( ! exists $mb->{properties}{requires}{'File::ShareDir'},
+ "File::ShareDir not added to 'requires'"
+);
+
+# Add 'share' dir and an 'other' dir and content
+$dist->add_file('share/foo.txt',<< '---');
+This is foo.txt
+---
+$dist->add_file('share/subdir/share/anotherbar.txt',<< '---');
+This is anotherbar.txt in a subdir - test for a bug in M::B 0.38 when full path contains 'share/.../*share/...' subdir
+---
+$dist->add_file('share/subdir/whatever/anotherfoo.txt',<< '---');
+This is anotherfoo.txt in a subdir - this shoud work on M::B 0.38
+---
+$dist->add_file('other/share/bar.txt',<< '---');
+This is bar.txt
+---
+$dist->regen;
+ok( -e catfile(qw/share foo.txt/), "Created 'share' directory" );
+ok( -d catfile(qw/share subdir share/), "Created 'share/subdir/share' directory" );
+ok( -d catfile(qw/share subdir whatever/), "Created 'share/subdir/whatever' directory" );
+ok( -e catfile(qw/other share bar.txt/), "Created 'other/share' directory" );
+
+# Check default when share_dir is not given
+stdout_stderr_of( sub { $mb = $dist->new_from_context });
+is( $mb->share_dir, undef,
+ "Default share_dir is undef even if 'share' exists"
+);
+ok( ! exists $mb->{properties}{requires}{'File::ShareDir'},
+ "File::ShareDir not added to 'requires'"
+);
+
+
+# share_dir set to scalar
+$dist->change_build_pl(
+ {
+ module_name => $dist->name,
+ license => 'perl',
+ share_dir => 'share',
+ }
+);
+$dist->regen;
+stdout_stderr_of( sub { $mb = $dist->new_from_context });
+is_deeply( $mb->share_dir, { dist => [ 'share' ] },
+ "Scalar share_dir set as dist-type share"
+);
+
+# share_dir set to arrayref
+$dist->change_build_pl(
+ {
+ module_name => $dist->name,
+ license => 'perl',
+ share_dir => [ 'share' ],
+ }
+);
+$dist->regen;
+stdout_stderr_of( sub { $mb = $dist->new_from_context });
+is_deeply( $mb->share_dir, { dist => [ 'share' ] },
+ "Arrayref share_dir set as dist-type share"
+);
+
+# share_dir set to hashref w scalar
+$dist->change_build_pl(
+ {
+ module_name => $dist->name,
+ license => 'perl',
+ share_dir => { dist => 'share' },
+ }
+);
+$dist->regen;
+stdout_stderr_of( sub { $mb = $dist->new_from_context });
+is_deeply( $mb->share_dir, { dist => [ 'share' ] },
+ "Hashref share_dir w/ scalar dist set as dist-type share"
+);
+
+# share_dir set to hashref w array
+$dist->change_build_pl(
+ {
+ module_name => $dist->name,
+ license => 'perl',
+ share_dir => { dist => [ 'share' ] },
+ }
+);
+$dist->regen;
+stdout_stderr_of( sub { $mb = $dist->new_from_context });
+is_deeply( $mb->share_dir, { dist => [ 'share' ] },
+ "Hashref share_dir w/ arrayref dist set as dist-type share"
+);
+
+# Generate a module sharedir (scalar)
+$dist->change_build_pl(
+ {
+ module_name => $dist->name,
+ license => 'perl',
+ share_dir => {
+ dist => 'share',
+ module => { $dist->name => 'other/share' },
+ },
+ }
+);
+$dist->regen;
+stdout_stderr_of( sub { $mb = $dist->new_from_context });
+is_deeply( $mb->share_dir,
+ { dist => [ 'share' ],
+ module => { $dist->name => ['other/share'] },
+ },
+ "Hashref share_dir w/ both dist and module shares (scalar-form)"
+);
+
+# Generate a module sharedir (array)
+$dist->change_build_pl(
+ {
+ module_name => $dist->name,
+ license => 'perl',
+ share_dir => {
+ dist => [ 'share' ],
+ module => { $dist->name => ['other/share'] },
+ },
+ }
+);
+$dist->regen;
+stdout_stderr_of( sub { $mb = $dist->new_from_context });
+is_deeply( $mb->share_dir,
+ { dist => [ 'share' ],
+ module => { $dist->name => ['other/share'] },
+ },
+ "Hashref share_dir w/ both dist and module shares (array-form)"
+);
+
+#--------------------------------------------------------------------------#
+# test constructing to/from mapping
+#--------------------------------------------------------------------------#
+
+is_deeply( $mb->_find_share_dir_files,
+ {
+ "share/foo.txt" => "dist/Simple-Share/foo.txt",
+ "share/subdir/share/anotherbar.txt" => "dist/Simple-Share/subdir/share/anotherbar.txt",
+ "share/subdir/whatever/anotherfoo.txt" => "dist/Simple-Share/subdir/whatever/anotherfoo.txt",
+ "other/share/bar.txt" => "module/Simple-Share/bar.txt",
+ },
+ "share_dir filemap for copying to lib complete"
+);
+
+#--------------------------------------------------------------------------#
+# test moving files to blib
+#--------------------------------------------------------------------------#
+
+$mb->dispatch('build');
+
+ok( -d 'blib', "Build ran and blib exists" );
+ok( -d 'blib/lib/auto/share', "blib/lib/auto/share exists" );
+
+my $share_list = Module::Build->rscan_dir('blib/lib/auto/share', sub {-f});
+
+SKIP:
+{
+
+skip 'filename case not necessarily preserved', 1 if $^O eq 'VMS';
+
+is_deeply(
+ [ sort @$share_list ], [
+ 'blib/lib/auto/share/dist/Simple-Share/foo.txt',
+ 'blib/lib/auto/share/dist/Simple-Share/subdir/share/anotherbar.txt',
+ 'blib/lib/auto/share/dist/Simple-Share/subdir/whatever/anotherfoo.txt',
+ 'blib/lib/auto/share/module/Simple-Share/bar.txt',
+ ],
+ "share_dir files copied to blib"
+);
+
+}
+
+#--------------------------------------------------------------------------#
+# test installing
+#--------------------------------------------------------------------------#
+
+my $temp_install = 'temp_install';
+mkdir $temp_install;
+ok( -d $temp_install, "temp install dir created" );
+
+$mb->install_base($temp_install);
+stdout_of( sub { $mb->dispatch('install') } );
+
+$share_list = Module::Build->rscan_dir(
+ "$temp_install/lib/perl5/auto/share", sub {-f}
+);
+
+SKIP:
+{
+
+skip 'filename case not necessarily preserved', 1 if $^O eq 'VMS';
+
+is_deeply(
+ [ sort @$share_list ], [
+ "$temp_install/lib/perl5/auto/share/dist/Simple-Share/foo.txt",
+ "$temp_install/lib/perl5/auto/share/dist/Simple-Share/subdir/share/anotherbar.txt",
+ "$temp_install/lib/perl5/auto/share/dist/Simple-Share/subdir/whatever/anotherfoo.txt",
+ "$temp_install/lib/perl5/auto/share/module/Simple-Share/bar.txt",
+ ],
+ "share_dir files correctly installed"
+);
+
+}
+
+#--------------------------------------------------------------------------#
+# test with File::ShareDir
+#--------------------------------------------------------------------------#
+
+SKIP: {
+ eval { require File::ShareDir; File::ShareDir->VERSION(1.00) };
+ skip "needs File::ShareDir 1.00", 2 if $@;
+
+ unshift @INC, File::Spec->catdir($temp_install, qw/lib perl5/);
+ require Simple::Share;
+
+ eval {File::ShareDir::dist_file('Simple-Share','foo.txt') };
+ is( $@, q{}, "Found shared dist file" );
+
+ eval {File::ShareDir::module_file('Simple::Share','bar.txt') };
+ is( $@, q{}, "Found shared module file" );
+}