summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cpan/Module-Build/t
diff options
context:
space:
mode:
authorafresh1 <afresh1@openbsd.org>2014-11-17 20:52:31 +0000
committerafresh1 <afresh1@openbsd.org>2014-11-17 20:52:31 +0000
commit6fb12b7054efc6b436584db6cef9c2f85c0d7e27 (patch)
treeaa09a524574ec7ae2f521a24573deeecb78ff66a /gnu/usr.bin/perl/cpan/Module-Build/t
parentAdd the Cammelia cipher to libcrypto. (diff)
downloadwireguard-openbsd-6fb12b7054efc6b436584db6cef9c2f85c0d7e27.tar.xz
wireguard-openbsd-6fb12b7054efc6b436584db6cef9c2f85c0d7e27.zip
Import perl-5.20.1
Diffstat (limited to 'gnu/usr.bin/perl/cpan/Module-Build/t')
-rwxr-xr-xgnu/usr.bin/perl/cpan/Module-Build/t/actions/installdeps.t11
-rw-r--r--gnu/usr.bin/perl/cpan/Module-Build/t/add_property_array.t16
-rw-r--r--gnu/usr.bin/perl/cpan/Module-Build/t/add_property_hash.t16
-rwxr-xr-xgnu/usr.bin/perl/cpan/Module-Build/t/bundle_inc.t12
-rwxr-xr-xgnu/usr.bin/perl/cpan/Module-Build/t/compat.t3
-rwxr-xr-xgnu/usr.bin/perl/cpan/Module-Build/t/extend.t28
-rwxr-xr-xgnu/usr.bin/perl/cpan/Module-Build/t/files.t5
-rwxr-xr-xgnu/usr.bin/perl/cpan/Module-Build/t/install.t23
-rw-r--r--gnu/usr.bin/perl/cpan/Module-Build/t/lib/DistGen.pm5
-rw-r--r--gnu/usr.bin/perl/cpan/Module-Build/t/lib/MBTest.pm13
-rwxr-xr-xgnu/usr.bin/perl/cpan/Module-Build/t/manifypods.t4
-rw-r--r--gnu/usr.bin/perl/cpan/Module-Build/t/manifypods_with_utf8.t68
-rwxr-xr-xgnu/usr.bin/perl/cpan/Module-Build/t/mymeta.t3
-rwxr-xr-xgnu/usr.bin/perl/cpan/Module-Build/t/new_from_context.t1
-rwxr-xr-xgnu/usr.bin/perl/cpan/Module-Build/t/pod_parser.t24
-rwxr-xr-xgnu/usr.bin/perl/cpan/Module-Build/t/ppm.t2
-rw-r--r--gnu/usr.bin/perl/cpan/Module-Build/t/properties/license.t8
-rw-r--r--gnu/usr.bin/perl/cpan/Module-Build/t/properties/requires.t4
-rwxr-xr-xgnu/usr.bin/perl/cpan/Module-Build/t/runthrough.t4
-rw-r--r--gnu/usr.bin/perl/cpan/Module-Build/t/test_reqs.t52
-rwxr-xr-xgnu/usr.bin/perl/cpan/Module-Build/t/tilde.t10
-rw-r--r--gnu/usr.bin/perl/cpan/Module-Build/t/unit_run_test_harness.t73
-rwxr-xr-xgnu/usr.bin/perl/cpan/Module-Build/t/xs.t10
23 files changed, 322 insertions, 73 deletions
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/actions/installdeps.t b/gnu/usr.bin/perl/cpan/Module-Build/t/actions/installdeps.t
index 5df98336b5c..ec900806550 100755
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/actions/installdeps.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/actions/installdeps.t
@@ -29,18 +29,17 @@ stdout_stderr_of( sub { $mb = $dist->new_from_context('verbose' => 1) } );
isa_ok( $mb, "Module::Build" );
like( $mb->cpan_client, qr/^\Q$^X\E/, "cpan_client is mocked with perl" );
+my $retval;
my $out = stdout_of( sub {
- $dist->run_build('installdeps')
+ $retval = $mb->dispatch('installdeps')
});
-ok( length($out), "ran mocked Build installdeps");
+ok( $retval, "ran mocked Build installdeps");
like( $out, qr/File::Spec/, "saw File::Spec prereq" );
like( $out, qr/Getopt::Long/, "saw Getopt::Long prereq" );
$out = stdout_stderr_of( sub {
- $dist->run_build('installdeps', '--cpan_client', 'ADLKASJDFLASDJ')
+ $retval = $mb->dispatch('installdeps', cpan_client => 'ADLKASJDFLASDJ');
});
-like( $out, qr/cpan_client .* is not executable/,
- "Build installdeps with bad cpan_client dies"
-);
+ok( !$retval, "Build installdeps with bad cpan_client fails" );
# vim:ts=2:sw=2:et:sta:sts=2
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/add_property_array.t b/gnu/usr.bin/perl/cpan/Module-Build/t/add_property_array.t
new file mode 100644
index 00000000000..3b405cb6105
--- /dev/null
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/add_property_array.t
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -w
+
+use strict;
+use lib 't/lib';
+use MBTest tests => 1;
+
+blib_load 'Module::Build';
+
+ADDPROP: {
+ package My::Build::Prop;
+ use base 'Module::Build';
+ __PACKAGE__->add_property( 'list_property' => []);
+}
+
+ok grep { $_ eq 'bundle_inc' } My::Build::Prop->array_properties, "has bundle_inc even after adding another array property";
+
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/add_property_hash.t b/gnu/usr.bin/perl/cpan/Module-Build/t/add_property_hash.t
new file mode 100644
index 00000000000..afd71f88fb5
--- /dev/null
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/add_property_hash.t
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -w
+
+use strict;
+use lib 't/lib';
+use MBTest tests => 1;
+
+blib_load 'Module::Build';
+
+ADDPROP: {
+ package My::Build::Prop;
+ use base 'Module::Build';
+ __PACKAGE__->add_property( 'hash_property' => {});
+}
+
+ok grep { $_ eq 'install_path' } My::Build::Prop->hash_properties, "has install_path even after adding another hash property";
+
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/bundle_inc.t b/gnu/usr.bin/perl/cpan/Module-Build/t/bundle_inc.t
index e974c261076..00dcf478ae5 100755
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/bundle_inc.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/bundle_inc.t
@@ -5,7 +5,6 @@ use lib 't/lib';
use MBTest; # or 'no_plan'
use DistGen;
use Config;
-use IO::File;
use File::Spec;
use ExtUtils::Packlist;
use ExtUtils::Installed;
@@ -93,15 +92,14 @@ ok( -e File::Spec->catfile( $dist_inc, qw/inc_Module-Build Module Build Base.pm/
# we can't edit the file.
eval {
- my $fh;
chmod 0666, $mb_file;
- $fh = IO::File->new($mb_file, "<") or die "Could not read $mb_file: $!";
+ open(my $fh, '<', $mb_file) or die "Could not read $mb_file: $!";
my $mb_code = do { local $/; <$fh> };
$mb_code =~ s{\$VERSION\s+=\s+\S+}{\$VERSION = 9999;};
- $fh->close;
- $fh = IO::File->new($mb_file, ">") or die "Could not write $mb_file: $!";
+ close $fh;
+ open($fh, '>', $mb_file) or die "Could not write $mb_file: $!";
print {$fh} $mb_code;
- $fh->close;
+ close $fh;
};
my $err = $@;
@@ -116,7 +114,7 @@ SKIP: {
stdout_of( sub { Module::Build->run_perl_script('Build.PL',[],[]) } );
ok( -e 'MYMETA.yml', 'MYMETA was created' );
- my $meta = IO::File->new('MYMETA.yml');
+ open(my $meta, '<', 'MYMETA.yml');
ok( $meta, "opened MYMETA.yml" );
ok( scalar( grep { /generated_by:.*9999/ } <$meta> ),
"dist_dir Build.PL loaded bundled Module::Build"
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/compat.t b/gnu/usr.bin/perl/cpan/Module-Build/t/compat.t
index 1546d2b814c..b6ddb938ee9 100755
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/compat.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/compat.t
@@ -4,7 +4,6 @@ use strict;
use lib 't/lib';
use MBTest;
use File::Spec;
-use IO::File;
use Config;
# Don't let our own verbosity/test_file get mixed up with our subprocess's
@@ -512,7 +511,7 @@ sub test_makefile_pl_requires_perl {
}
sub find_params_in_makefile {
- my $fh = IO::File->new( $makefile, 'r' )
+ open(my $fh, '<', $makefile )
or die "Can't read $makefile: $!";
local($/) = "\n";
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/extend.t b/gnu/usr.bin/perl/cpan/Module-Build/t/extend.t
index 505a47360ca..62830c24e7f 100755
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/extend.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/extend.t
@@ -2,7 +2,7 @@
use strict;
use lib 't/lib';
-use MBTest tests => 64;
+use MBTest tests => 63;
blib_load('Module::Build');
@@ -183,23 +183,29 @@ print "Hello, World!\n";
ok my $mb = Module::Build->new(
module_name => $dist->name,
license => 'perl',
- meta_add => {foo => 'bar'},
+ meta_add => {abstract => 'bar'},
conflicts => {'Foo::Barxx' => 0},
);
my $data = $mb->get_metadata;
- is $data->{foo}, 'bar';
+ is_deeply $data->{abstract}, 'bar';
- $mb->meta_merge(foo => 'baz');
+ $mb->meta_merge(abstract => 'baz');
$data = $mb->get_metadata;
- is $data->{foo}, 'baz';
-
- $mb->meta_merge(conflicts => {'Foo::Fooxx' => 0});
+ is_deeply $data->{abstract}, 'baz';
+
+ $mb->meta_merge(
+ 'meta-spec' => { version => 2 },
+ prereqs => {
+ test => {
+ requirements => {
+ 'Foo::Fooxx' => 0,
+ }
+ }
+ }
+ );
$data = $mb->get_metadata;
- is_deeply $data->{conflicts}, {'Foo::Barxx' => 0, 'Foo::Fooxx' => 0};
+ is_deeply $data->{prereqs}{test}{requirements}, { 'Foo::Fooxx' => 0 };
- $mb->meta_add(conflicts => {'Foo::Bazxx' => 0});
- $data = $mb->get_metadata;
- is_deeply $data->{conflicts}, {'Foo::Bazxx' => 0, 'Foo::Fooxx' => 0};
}
{
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/files.t b/gnu/usr.bin/perl/cpan/Module-Build/t/files.t
index 625a4739740..e951b800f39 100755
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/files.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/files.t
@@ -6,7 +6,6 @@ use MBTest tests => 4;
blib_load('Module::Build');
-use IO::File;
my $tmp = MBTest->tmpdir;
use DistGen;
@@ -26,9 +25,9 @@ my $mb = Module::Build->new_from_context;
my $filename = 'file with spaces.txt';
my $file = File::Spec->catfile($tmp[0], $filename);
- my $fh = IO::File->new($file, '>') or die "Can't create $file: $!";
+ open(my $fh, '>', $file) or die "Can't create $file: $!";
print $fh "Foo\n";
- $fh->close;
+ close $fh;
ok -e $file;
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/install.t b/gnu/usr.bin/perl/cpan/Module-Build/t/install.t
index 2d487f679be..fde3958d05f 100755
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/install.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/install.t
@@ -2,7 +2,7 @@
use strict;
use lib 't/lib';
-use MBTest tests => 35;
+use MBTest tests => 34;
blib_load('Module::Build');
@@ -36,18 +36,15 @@ $dist->regen;
use File::Spec::Functions qw( catdir );
my $mb = Module::Build->new_from_context(
- # need default install paths to ensure manpages & HTML get generated
+ # Need default install paths to ensure manpages get generated.
installdirs => 'site',
config => {
installman1dir => catdir($tmp, 'man', 'man1'),
installman3dir => catdir($tmp, 'man', 'man3'),
- installhtml1dir => catdir($tmp, 'html'),
- installhtml3dir => catdir($tmp, 'html'),
-
installsiteman1dir => catdir($tmp, 'site', 'man', 'man1'),
installsiteman3dir => catdir($tmp, 'site', 'man', 'man3'),
- installsitehtml1dir => catdir($tmp, 'site', 'html'),
- installsitehtml3dir => catdir($tmp, 'site', 'html'),
+ ## We also used to have HTML paths here, but building HTML docs
+ ## can be super slow, and we never checked the result anyway.
}
);
@@ -166,10 +163,6 @@ is $@, '';
'--install_base', $basedir])};
is $@, '';
- eval {$mb->run_perl_script($cmd, [], ['install', '--destdir', $destdir,
- '--install_base', $basedir, '--install_base', $basedir])};
- is $@, '';
-
$install_to = File::Spec->catfile($destdir, $libdir, $dist->name ) . '.pm';
is -e $install_to, 1, "Look for file at $install_to";
@@ -209,14 +202,6 @@ Simple Man <simple@example.com>
is keys %$pods, 1;
my $expect = $mb->localize_file_path('lib/Simple/Docs.pod');
- # TODO:
- # True for traditional VMS, but will need to be changed when ODS-5 support
- # for case preserved filenames is active.
- # The issue is that the keys to the $pods hash are currently being set to
- # lowercase on VMS so can not be found in exact case.
-
- $expect = lc($expect) if $^O eq 'VMS';
-
is $pods->{$expect}, $expect;
my $pms = $mb->_find_file_by_type('awefawef', 'lib');
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/lib/DistGen.pm b/gnu/usr.bin/perl/cpan/Module-Build/t/lib/DistGen.pm
index ae8ed343907..52493724f5e 100644
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/lib/DistGen.pm
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/lib/DistGen.pm
@@ -15,7 +15,6 @@ use File::Basename ();
use File::Find ();
use File::Path ();
use File::Spec ();
-use IO::File ();
use Tie::CPHash;
use Data::Dumper;
@@ -297,7 +296,7 @@ sub _gen_manifest {
my $self = shift;
my $manifest = shift;
- my $fh = IO::File->new( ">$manifest" ) or do {
+ open(my $fh, '>', $manifest ) or do {
die "Can't write '$manifest'\n";
};
@@ -368,7 +367,7 @@ sub regen {
1 while unlink( $fullname );
}
- my $fh = IO::File->new(">$fullname") or do {
+ open(my $fh, '>', $fullname) or do {
die "Can't write '$fullname'\n";
};
print $fh $self->{filedata}{$file};
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/lib/MBTest.pm b/gnu/usr.bin/perl/cpan/Module-Build/t/lib/MBTest.pm
index 0df382fc6aa..b12dc50e769 100644
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/lib/MBTest.pm
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/lib/MBTest.pm
@@ -2,7 +2,6 @@ package MBTest;
use strict;
-use IO::File ();
use File::Spec;
use File::Temp ();
use File::Path ();
@@ -159,7 +158,7 @@ sub stdout_stderr_of {
}
sub slurp {
- my $fh = IO::File->new($_[0]) or die "Can't open $_[0]: $!";
+ open(my $fh, '<', $_[0]) or die "Can't open $_[0]: $!";
local $/;
return scalar <$fh>;
}
@@ -198,7 +197,15 @@ sub find_in_path {
}
sub check_compiler {
- return (1,1) if $ENV{PERL_CORE};
+ if ($ENV{PERL_CORE}) {
+ require IPC::Cmd;
+ if ( $Config{usecrosscompile} && !IPC::Cmd::can_run($Config{cc}) ) {
+ return;
+ }
+ else {
+ return(1,1);
+ }
+ }
local $SIG{__WARN__} = sub {};
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/manifypods.t b/gnu/usr.bin/perl/cpan/Module-Build/t/manifypods.t
index aa33ffccd0f..de2a3e4fd23 100755
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/manifypods.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/manifypods.t
@@ -68,13 +68,11 @@ my $mb = Module::Build->new(
scripts => [ File::Spec->catfile( 'bin', 'nopod.pl' ),
File::Spec->catfile( 'bin', 'haspod.pl' ) ],
- # need default install paths to ensure manpages & HTML get generated
+ # Need default install paths to ensure manpages get generated
installdirs => 'site',
config => {
installsiteman1dir => catdir($tmp, 'site', 'man', 'man1'),
installsiteman3dir => catdir($tmp, 'site', 'man', 'man3'),
- installsitehtml1dir => catdir($tmp, 'site', 'html'),
- installsitehtml3dir => catdir($tmp, 'site', 'html'),
}
);
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/manifypods_with_utf8.t b/gnu/usr.bin/perl/cpan/Module-Build/t/manifypods_with_utf8.t
new file mode 100644
index 00000000000..ebb0db64c4c
--- /dev/null
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/manifypods_with_utf8.t
@@ -0,0 +1,68 @@
+package ManifypodsWithUtf8;
+use strict;
+use utf8;
+use Test::More;
+
+use lib 't/lib';
+blib_load('Module::Build');
+blib_load('Module::Build::ConfigData');
+
+SKIP: {
+ unless ( Module::Build::ConfigData->feature('manpage_support') ) {
+ skip 'manpage_support feature is not enabled';
+ }
+}
+
+use MBTest tests => 2;
+use File::Spec::Functions qw( catdir );
+
+use Cwd ();
+my $cwd = Cwd::cwd;
+my $tmp = MBTest->tmpdir;
+
+use DistGen;
+my $dist = DistGen->new( dir => $tmp );
+my $content = <<'---';
+
+=encoding utf8
+
+=head1 NAME
+
+Simple::PodWithUtf8 - POD with some (ç á à ô) special chars
+
+=cut
+---
+utf8::encode($content);
+$dist->add_file( 'lib/Simple/PodWithUtf8.pod', $content);
+$dist->regen;
+$dist->chdir_in;
+
+my $destdir = catdir($cwd, 't', 'install_test' . $$);
+
+my $mb = Module::Build->new(
+ module_name => $dist->name,
+ install_base => $destdir,
+
+ # need default install paths to ensure manpages get generated
+ installdirs => 'site',
+ config => {
+ installsiteman1dir => catdir($tmp, 'site', 'man', 'man1'),
+ installsiteman3dir => catdir($tmp, 'site', 'man', 'man3'),
+ },
+ extra_manify_args => { utf8 => 1 },
+ );
+$mb->add_to_cleanup($destdir);
+
+
+$mb->dispatch('build');
+my $sep = $mb->manpage_separator;
+my $ext3 = $mb->config('man3ext');
+my $to = File::Spec->catfile('blib', 'libdoc', "Simple${sep}PodWithUtf8.${ext3}");
+
+ok(-e $to, "Manpage is found at $to");
+open my $pod, '<:encoding(utf-8)', $to or diag "Could not open $to: $!";
+my $pod_content = do { local $/; <$pod> };
+close $pod;
+
+like($pod_content, qr/ \(ç á à ô\) /, "POD should contain special characters");
+
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/mymeta.t b/gnu/usr.bin/perl/cpan/Module-Build/t/mymeta.t
index d760edadbb7..4e209838a82 100755
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/mymeta.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/mymeta.t
@@ -24,6 +24,9 @@ my \$builder = Module::Build->new(
requires => {
'File::Spec' => ( \$ENV{BUMP_PREREQ} ? 0.86 : 0 ),
},
+ configure_requires => {
+ 'Module::Build' => '0.42',
+ }
);
\$builder->create_build_script();
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/new_from_context.t b/gnu/usr.bin/perl/cpan/Module-Build/t/new_from_context.t
index f45a1760eb1..a9ec00b8641 100755
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/new_from_context.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/new_from_context.t
@@ -6,7 +6,6 @@ use MBTest tests => 2;
blib_load('Module::Build');
-use IO::File;
my $tmp = MBTest->tmpdir;
use DistGen;
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/pod_parser.t b/gnu/usr.bin/perl/cpan/Module-Build/t/pod_parser.t
index 8c75e7d7fac..d4ebcdc91d2 100755
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/pod_parser.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/pod_parser.t
@@ -2,7 +2,7 @@
use strict;
use lib 't/lib';
-use MBTest tests => 12;
+use MBTest tests => 14;
blib_load('Module::Build::PodParser');
@@ -113,3 +113,25 @@ EOF
is $pp->get_author->[0], 'C<Foo::Bar> was written by Engelbert Humperdinck I<E<lt>eh@example.comE<gt>> in 2004.', 'author';
is $pp->get_abstract, 'Perl extension for blah blah blah', 'abstract';
}
+
+{
+local *FH;
+tie *FH, 'IO::StringBased', <<'EOF';
+=head1 NAME
+
+Foo_Bar - Perl extension for eating pie
+
+=head1 AUTHOR
+
+C<Foo_Bar> was written by Engelbert Humperdinck I<E<lt>eh@example.comE<gt>> in 2004.
+
+Home page: http://example.com/~eh/
+
+=cut
+EOF
+
+
+ my $pp = Module::Build::PodParser->new(fh => \*FH);
+ ok $pp, 'object created';
+ is $pp->get_abstract, 'Perl extension for eating pie', 'abstract';
+}
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/ppm.t b/gnu/usr.bin/perl/cpan/Module-Build/t/ppm.t
index 9de28ec4f3f..4bc473ddf05 100755
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/ppm.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/ppm.t
@@ -83,6 +83,7 @@ my $mb = Module::Build->new_from_context(
( installsitehtml1dir => catdir($tmp, 'site', 'html'),
installsitehtml3dir => catdir($tmp, 'site', 'html') ) : () ),
},
+ html_links => 0,
);
@@ -163,6 +164,7 @@ SKIP: {
installsiteman1dir => catdir($tmp, 'site', 'man', 'man1'),
installsiteman3dir => catdir($tmp, 'site', 'man', 'man3'),
},
+ html_links => 0,
);
$mb->dispatch('ppmdist');
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
index db63b3951bb..bb7247e2c55 100644
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/properties/license.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/properties/license.t
@@ -30,8 +30,8 @@ blib_load('Module::Build');
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/",
+ 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"
);
@@ -55,8 +55,8 @@ blib_load('Module::Build');
my $meta = $mb->get_metadata( fatal => 0 );
- is( $meta->{license} => 'unrestricted', "META license will be 'unrestricted'" );
- is( $meta->{resources}{license}, "http://example.com/vaporware/",
+ is_deeply( $meta->{license} => [ 'unrestricted' ], "META license will be 'unrestricted'" );
+ is_deeply( $meta->{resources}{license}, [ "http://example.com/vaporware/" ],
"META license URL is correct"
);
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
index 72a2e6d9aba..6511e801690 100644
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/properties/requires.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/properties/requires.t
@@ -31,7 +31,7 @@ $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");
+is($prereqs->{runtime}{requires}{'File::Basename'}, 0, "undef prereq converted to 0");
#--------------------------------------------------------------------------#
# try empty string prereq version
@@ -48,7 +48,7 @@ $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");
+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/gnu/usr.bin/perl/cpan/Module-Build/t/runthrough.t b/gnu/usr.bin/perl/cpan/Module-Build/t/runthrough.t
index 1c0edf4402a..1f6730e3090 100755
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/runthrough.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/runthrough.t
@@ -125,7 +125,7 @@ ok grep {$_ eq 'save_out' } $mb->cleanup;
ok ! -e File::Spec->catdir('Simple-0.01', 'blib');
# Make sure all of the above was done by the new version of Module::Build
- my $fh = IO::File->new(File::Spec->catfile($dist->dirname, 'META.yml'));
+ open(my $fh, '<', File::Spec->catfile($dist->dirname, 'META.yml'));
my $contents = do {local $/; <$fh>};
$contents =~ /Module::Build version ([0-9_.]+)/m;
cmp_ok $1, '==', $mb->VERSION, "Check version used to create META.yml: $1 == " . $mb->VERSION;
@@ -151,7 +151,7 @@ ok grep {$_ eq 'save_out' } $mb->cleanup;
SKIP: {
skip("We do not rewrite shebang on VMS", 1) if $^O eq 'VMS';
- my $fh = IO::File->new($blib_script);
+ open(my $fh, '<', $blib_script);
my $first_line = <$fh>;
isnt $first_line, "#!perl -w\n", "should rewrite the shebang line";
}
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/test_reqs.t b/gnu/usr.bin/perl/cpan/Module-Build/t/test_reqs.t
new file mode 100644
index 00000000000..bd04f8679a8
--- /dev/null
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/test_reqs.t
@@ -0,0 +1,52 @@
+#!/usr/bin/perl -w
+
+use strict;
+use lib 't/lib';
+use MBTest;
+use CPAN::Meta 2.110420;
+use CPAN::Meta::YAML;
+use Parse::CPAN::Meta 1.4401;
+plan tests => 4;
+
+blib_load('Module::Build');
+
+my $tmp = MBTest->tmpdir;
+
+use DistGen;
+my $dist = DistGen->new( dir => $tmp );
+$dist->change_file('Build.PL', <<"---");
+use strict;
+use Module::Build;
+
+my \$builder = Module::Build->new(
+ module_name => '$dist->{name}',
+ license => 'perl',
+ requires => {
+ 'File::Spec' => 0,
+ },
+ test_requires => {
+ 'Test::More' => 0,
+ }
+);
+
+\$builder->create_build_script();
+---
+$dist->regen;
+$dist->chdir_in;
+$dist->run_build_pl;
+my $output = stdout_stderr_of sub { $dist->run_build('distmeta') };
+
+for my $file ( qw/MYMETA META/ ) {
+ my $meta = Parse::CPAN::Meta->load_file($file.".json");
+ is_deeply($meta->{prereqs}->{runtime},{
+ requires => {
+ 'File::Spec' => '0',
+ }
+ }, "runtime prereqs in $file");
+ is_deeply($meta->{prereqs}->{test},{
+ requires => {
+ 'Test::More' => '0',
+ }
+ }, "test prereqs in $file");
+}
+
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/tilde.t b/gnu/usr.bin/perl/cpan/Module-Build/t/tilde.t
index 04f0210f30b..09673f6b92d 100755
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/tilde.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/tilde.t
@@ -100,14 +100,14 @@ SKIP: {
or !defined $info[7] or !defined $info[0];
my ($me, $home) = @info[0,7];
- my $expected = "$home/fooxzy";
-
if ($^O eq 'VMS') {
- # Convert the path to UNIX format and trim off the trailing slash
- $home = VMS::Filespec::unixify($home);
+ # Convert the path to UNIX format and trim off the trailing slash.
+ # Also, the fake module we're in has mangled $ENV{HOME} for its own
+ # purposes; getpwuid doesn't know about that but _detildefy does.
+ $home = VMS::Filespec::unixify($ENV{HOME});
$home =~ s#/$##;
- $expected = $home . '/../[^/]+' . '/fooxzy';
}
+ my $expected = "$home/fooxzy";
like( run_sample( $p => "~$me/fooxzy")->$p(), qr(\Q$expected\E)i );
}
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/unit_run_test_harness.t b/gnu/usr.bin/perl/cpan/Module-Build/t/unit_run_test_harness.t
new file mode 100644
index 00000000000..e6a7f53bf05
--- /dev/null
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/unit_run_test_harness.t
@@ -0,0 +1,73 @@
+#!/usr/bin/perl -w
+
+use strict;
+use lib 't/lib';
+use MBTest tests => 9;
+
+blib_load('Module::Build');
+
+my $tmp = MBTest->tmpdir;
+
+use DistGen;
+my $dist = DistGen->new( dir => $tmp );
+$dist->regen;
+
+$dist->chdir_in;
+
+#########################
+
+
+# make sure Test::Harness loaded before we define Test::Harness::runtests otherwise we'll
+# get another redefined warning inside Test::Harness::runtests
+use Test::Harness;
+
+{
+ package MB::Subclass;
+ use base qw(Module::Build);
+ sub harness_switches { return }
+}
+
+{
+ local $SIG{__WARN__} = sub { die "Termination after a warning: $_[0]"};
+ my $mock1 = { A => 1 };
+ my $mock2 = { B => 2 };
+
+ no warnings qw[redefine once];
+
+ # This runs run_test_harness with Test::Harness::switches = undef and harness_switches() returning empty list,
+ # ensure there are no warnings, and output is empty too
+ {
+ my $mb = MB::Subclass->new( module_name => $dist->name );
+ local *Test::Harness::runtests = sub {
+ is shift(), $mock1, "runtests ran with expected parameters";
+ is shift(), $mock2, "runtests ran with expected parameters";
+ is $Test::Harness::switches, '', "switches are undef";
+ is $Test::Harness::Switches, '', "switches are undef";
+ };
+
+ # $Test::Harness::switches and $Test::Harness::switches are aliases, but we pretend we don't know this
+ local $Test::Harness::switches = '';
+ local $Test::Harness::switches = '';
+ $mb->run_test_harness([$mock1, $mock2]);
+
+ ok 1, "run_test_harness should not produce warning if Test::Harness::[Ss]witches are undef and harness_switches() return empty list";
+ }
+
+ # This runs run_test_harness with Test::Harness::switches = '' and harness_switches() returning empty list,
+ # ensure there are no warnings, and switches are empty string
+ {
+ my $mb = MB::Subclass->new( module_name => $dist->name );
+ local *Test::Harness::runtests = sub {
+ is shift(), $mock1, "runtests ran with expected parameters";
+ is shift(), $mock2, "runtests ran with expected parameters";
+ is $Test::Harness::switches, '', "switches are empty string";
+ is $Test::Harness::Switches, '', "switches are empty string";
+ };
+
+ # $Test::Harness::switches and $Test::Harness::switches are aliases, but we pretend we don't know this
+ local $Test::Harness::switches = '';
+ local $Test::Harness::switches = '';
+ $mb->run_test_harness([$mock1, $mock2]);
+ }
+
+}
diff --git a/gnu/usr.bin/perl/cpan/Module-Build/t/xs.t b/gnu/usr.bin/perl/cpan/Module-Build/t/xs.t
index 84f82d9a601..6d813610f33 100755
--- a/gnu/usr.bin/perl/cpan/Module-Build/t/xs.t
+++ b/gnu/usr.bin/perl/cpan/Module-Build/t/xs.t
@@ -19,7 +19,7 @@ blib_load('Module::Build');
} elsif ( !$Config{usedl} ) {
plan skip_all => 'Perl not compiled for dynamic loading'
} else {
- plan tests => 20;
+ plan tests => 22;
}
require Cwd;
$tmp = MBTest->tmpdir( $tmp_exec ? () : (DIR => Cwd::cwd) );
@@ -117,6 +117,14 @@ is $@, '';
stdout_stderr_of( sub { eval { $mb->dispatch('test') } } );
is $@, '';
+eval { $mb->dispatch('clean') };
+
+eval { $mb->dispatch('build', 'pureperl_only' => 1) };
+like $@, qr/\ACan\'t build xs files under --pureperl-only/, 'Can\'t build xs under pureperl';
+
+eval { $mb->dispatch('build', pureperl_only => 1, allow_pureperl => 1) };
+is $@, '', 'Can\'t build xs under pureperl, unless allow_pureperl';
+
eval { $mb->dispatch('realclean') };
is $@, '';