summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cpan/Module-Build/t/properties
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2013-03-25 20:06:16 +0000
committersthen <sthen@openbsd.org>2013-03-25 20:06:16 +0000
commit898184e3e61f9129feb5978fad5a8c6865f00b92 (patch)
tree56f32aefc1eed60b534611007c7856f82697a205 /gnu/usr.bin/perl/cpan/Module-Build/t/properties
parentPGSHIFT -> PAGE_SHIFT (diff)
downloadwireguard-openbsd-898184e3e61f9129feb5978fad5a8c6865f00b92.tar.xz
wireguard-openbsd-898184e3e61f9129feb5978fad5a8c6865f00b92.zip
import perl 5.16.3 from CPAN - worked on by Andrew Fresh and myself
Diffstat (limited to 'gnu/usr.bin/perl/cpan/Module-Build/t/properties')
-rw-r--r--gnu/usr.bin/perl/cpan/Module-Build/t/properties/dist_suffix.t33
-rw-r--r--gnu/usr.bin/perl/cpan/Module-Build/t/properties/license.t66
-rw-r--r--gnu/usr.bin/perl/cpan/Module-Build/t/properties/release_status.t204
-rw-r--r--gnu/usr.bin/perl/cpan/Module-Build/t/properties/requires.t54
-rwxr-xr-xgnu/usr.bin/perl/cpan/Module-Build/t/properties/share_dir.t16
5 files changed, 372 insertions, 1 deletions
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/properties/dist_suffix.t b/gnu/usr.bin/perl/cpan/Module-Build/t/properties/dist_suffix.t
new file mode 100644
index 00000000000..aaee1126691
--- /dev/null
+++ b/gnu/usr.bin/perl/cpan/Module-Build/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/gnu/usr.bin/perl/cpan/Module-Build/t/properties/license.t b/gnu/usr.bin/perl/cpan/Module-Build/t/properties/license.t
new file mode 100644
index 00000000000..db63b3951bb
--- /dev/null
+++ b/gnu/usr.bin/perl/cpan/Module-Build/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( $meta->{license} => 'perl', "META license will be 'perl'" );
+ is( $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( $meta->{license} => 'unrestricted', "META license will be 'unrestricted'" );
+ is( $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/gnu/usr.bin/perl/cpan/Module-Build/t/properties/release_status.t b/gnu/usr.bin/perl/cpan/Module-Build/t/properties/release_status.t
new file mode 100644
index 00000000000..45c7f3381cb
--- /dev/null
+++ b/gnu/usr.bin/perl/cpan/Module-Build/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/gnu/usr.bin/perl/cpan/Module-Build/t/properties/requires.t b/gnu/usr.bin/perl/cpan/Module-Build/t/properties/requires.t
new file mode 100644
index 00000000000..72a2e6d9aba
--- /dev/null
+++ b/gnu/usr.bin/perl/cpan/Module-Build/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->{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->{requires}{'File::Basename'}, 0, "empty string prereq converted to 0");
+
+
+# vim:ts=2:sw=2:et:sta:sts=2
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/properties/share_dir.t b/gnu/usr.bin/perl/cpan/Module-Build/t/properties/share_dir.t
index 1d81a0aa45c..f1cda13429a 100755
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/properties/share_dir.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/properties/share_dir.t
@@ -9,7 +9,7 @@ use File::Spec::Functions qw/catdir catfile/;
# Begin testing
#--------------------------------------------------------------------------#
-plan tests => 21;
+plan tests => 23;
blib_load('Module::Build');
@@ -43,11 +43,19 @@ ok( ! exists $mb->{properties}{requires}{'File::ShareDir'},
$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
@@ -163,6 +171,8 @@ is_deeply( $mb->share_dir,
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"
@@ -187,6 +197,8 @@ 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"
@@ -217,6 +229,8 @@ 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"