summaryrefslogtreecommitdiff
path: root/lib/ExtUtils/t
diff options
context:
space:
mode:
authorSteve Hay <SteveHay@planit.com>2008-09-29 09:14:25 +0000
committerSteve Hay <SteveHay@planit.com>2008-09-29 09:14:25 +0000
commit2e65e370d35678c61f33c1e7f90fd07d0254d085 (patch)
treeb8f1e09ca87551677dbaed97155c3e625532baa0 /lib/ExtUtils/t
parent494bd33348b985a58018f4b68f5d051cf954d541 (diff)
downloadperl-2e65e370d35678c61f33c1e7f90fd07d0254d085.tar.gz
Upgrade to ExtUtils-MakeMaker-6.46
Local changes 32905 and 32964 in MM_Unix.pm and 33259 in MM_Unix.t remain p4raw-id: //depot/perl@34440
Diffstat (limited to 'lib/ExtUtils/t')
-rw-r--r--lib/ExtUtils/t/MM_Unix.t16
-rw-r--r--lib/ExtUtils/t/MM_Win32.t33
-rw-r--r--lib/ExtUtils/t/basic.t39
-rw-r--r--lib/ExtUtils/t/metafile_data.t135
-rw-r--r--lib/ExtUtils/t/metafile_file.t293
-rw-r--r--lib/ExtUtils/t/writemakefile_args.t38
6 files changed, 513 insertions, 41 deletions
diff --git a/lib/ExtUtils/t/MM_Unix.t b/lib/ExtUtils/t/MM_Unix.t
index 1f2762ec83..476bf2483d 100644
--- a/lib/ExtUtils/t/MM_Unix.t
+++ b/lib/ExtUtils/t/MM_Unix.t
@@ -35,17 +35,16 @@ my $os = ($ExtUtils::MM_Unix::Is{OS2} || 0)
+ ($ExtUtils::MM_Unix::Is{Win32} || 0)
+ ($ExtUtils::MM_Unix::Is{Dos} || 0)
+ ($ExtUtils::MM_Unix::Is{VMS} || 0);
-ok ( $os <= 1, 'There can be only one (or none)');
+cmp_ok ( $os, '<=', 1, 'There can be only one (or none)');
-cmp_ok ($ExtUtils::MM_Unix::VERSION, '>=', '1.12606', 'Should be at least version 1.12606');
+is($ExtUtils::MM_Unix::VERSION, $ExtUtils::MakeMaker::VERSION, 'MM_Unix has a $VERSION');
# when the following calls like canonpath, catdir etc are replaced by
# File::Spec calls, the test's become a bit pointless
-foreach ( qw( xx/ ./xx/ xx/././xx xx///xx) )
- {
- is ($class->canonpath($_), File::Spec->canonpath($_), "canonpath $_");
- }
+foreach ( qw( xx/ ./xx/ xx/././xx xx///xx) ) {
+ is ($class->canonpath($_), File::Spec->canonpath($_), "canonpath $_");
+}
is ($class->catdir('xx','xx'), File::Spec->catdir('xx','xx'),
'catdir(xx, xx) => xx/xx');
@@ -198,10 +197,9 @@ is ($t->perm_rwx(),'755', 'perm_rwx() is 755');
###############################################################################
# post_constants, postamble, post_initialize
-foreach (qw/ post_constants postamble post_initialize/)
- {
+foreach (qw/ post_constants postamble post_initialize/) {
is ($t->$_(),'', "$_() is an empty string");
- }
+}
###############################################################################
# replace_manpage_separator
diff --git a/lib/ExtUtils/t/MM_Win32.t b/lib/ExtUtils/t/MM_Win32.t
index 866c135bc5..c779da2c4e 100644
--- a/lib/ExtUtils/t/MM_Win32.t
+++ b/lib/ExtUtils/t/MM_Win32.t
@@ -16,7 +16,7 @@ use Test::More;
BEGIN {
if ($^O =~ /MSWin32/i) {
- plan tests => 41;
+ plan tests => 49;
} else {
plan skip_all => 'This is not Win32';
}
@@ -234,6 +234,37 @@ EOSCRIPT
}
unlink "${script_name}$script_ext" if -f "${script_name}$script_ext";
+# is_make_type()
+{
+ # Check for literal nmake
+ SKIP: {
+ skip("Not using 'nmake'", 2) unless $Config{make} eq 'nmake';
+ ok( $MM->is_make_type('nmake'), '->is_make_type(nmake) true' );
+ ok( ! $MM->is_make_type('dmake'), '->is_make_type(dmake) false' );
+ }
+
+ # Check for literal nmake
+ SKIP: {
+ skip("Not using /nmake/", 2) unless $Config{make} =~ /nmake/;
+ ok( $MM->is_make_type('nmake'), '->is_make_type(nmake) true' );
+ ok( ! $MM->is_make_type('dmake'), '->is_make_type(dmake) false' );
+ }
+
+ # Check for literal dmake
+ SKIP: {
+ skip("Not using 'dmake'", 2) unless $Config{make} eq 'dmake';
+ ok( $MM->is_make_type('dmake'), '->is_make_type(dmake) true' );
+ ok( ! $MM->is_make_type('nmake'), '->is_make_type(nmake) false' );
+ }
+
+ # Check for literal dmake
+ SKIP: {
+ skip("Not using /dmake/", 2) unless $Config{make} =~ /dmake/;
+ ok( $MM->is_make_type('dmake'), '->is_make_type(dmake) true' );
+ ok( ! $MM->is_make_type('nmake'), '->is_make_type(nmake) false' );
+ }
+
+}
# xs_o() should look into that
# top_targets() should look into that
diff --git a/lib/ExtUtils/t/basic.t b/lib/ExtUtils/t/basic.t
index 64352d85cb..b26b3e2886 100644
--- a/lib/ExtUtils/t/basic.t
+++ b/lib/ExtUtils/t/basic.t
@@ -17,7 +17,7 @@ use strict;
use Config;
use ExtUtils::MakeMaker;
-use Test::More tests => 83;
+use Test::More tests => 85;
use MakeMaker::Test::Utils;
use MakeMaker::Test::Setup::BFD;
use File::Find;
@@ -250,25 +250,40 @@ ok( !-f 'META.yml', 'META.yml not written to source dir' );
ok( -f $meta_yml, 'META.yml written to dist dir' );
ok( !-e "META_new.yml", 'temp META.yml file not left around' );
+SKIP: {
+ # META.yml spec 1.4 was added in 0.11
+ skip "Test::YAML::Meta >= 0.11 required", 2
+ unless eval { require Test::YAML::Meta } and
+ Test::YAML::Meta->VERSION >= 0.11;
+
+ Test::YAML::Meta::meta_spec_ok($meta_yml);
+}
+
ok open META, $meta_yml or diag $!;
my $meta = join '', <META>;
ok close META;
is $meta, <<"END";
--- #YAML:1.0
-name: Big-Dummy
-version: 0.01
-abstract: Try "our" hot dog's
-license: ~
-author:
+name: Big-Dummy
+version: 0.01
+abstract: Try "our" hot dog's
+author:
- Michael G Schwern <schwern\@pobox.com>
-generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION
-distribution_type: module
-requires:
- strict: 0
+license: unknown
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+requires:
+ strict: 0
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.3.html
- version: 1.3
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
END
my $manifest = maniread("$distdir/MANIFEST");
diff --git a/lib/ExtUtils/t/metafile_data.t b/lib/ExtUtils/t/metafile_data.t
new file mode 100644
index 0000000000..597e448cf1
--- /dev/null
+++ b/lib/ExtUtils/t/metafile_data.t
@@ -0,0 +1,135 @@
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use Test::More tests => 3;
+
+use Data::Dumper;
+
+require ExtUtils::MM_Any;
+
+my $new_mm = sub {
+ return bless {@_}, 'ExtUtils::MM_Any';
+};
+
+{
+ my $mm = $new_mm->(
+ DISTNAME => 'Foo-Bar',
+ VERSION => 1.23,
+ PM => {
+ "Foo::Bar" => 'lib/Foo/Bar.pm',
+ },
+ );
+
+ is_deeply [$mm->metafile_data], [
+ name => 'Foo-Bar',
+ version => 1.23,
+ abstract => undef,
+ author => [],
+ license => 'unknown',
+ distribution_type => 'module',
+
+ configure_requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ },
+
+ no_index => {
+ directory => [qw(t inc)],
+ },
+
+ generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+ 'meta-spec' => {
+ url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
+ version => 1.4
+ },
+ ];
+
+
+ is_deeply [$mm->metafile_data({}, { no_index => { directory => [qw(foo)] } })], [
+ name => 'Foo-Bar',
+ version => 1.23,
+ abstract => undef,
+ author => [],
+ license => 'unknown',
+ distribution_type => 'module',
+
+ configure_requires => {
+ 'ExtUtils::MakeMaker' => 0,
+ },
+
+ no_index => {
+ directory => [qw(t inc foo)],
+ },
+
+ generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+ 'meta-spec' => {
+ url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
+ version => 1.4
+ },
+ ], 'rt.cpan.org 39348';
+}
+
+
+{
+ my $mm = $new_mm->(
+ DISTNAME => 'Foo-Bar',
+ VERSION => 1.23,
+ AUTHOR => 'Some Guy',
+ PREREQ_PM => {
+ Foo => 2.34,
+ Bar => 4.56,
+ },
+ );
+
+ is_deeply [$mm->metafile_data(
+ {
+ configure_requires => {
+ Stuff => 2.34
+ },
+ wobble => 42
+ },
+ {
+ no_index => {
+ package => "Thing"
+ },
+ wibble => 23
+ },
+ )],
+ [
+ name => 'Foo-Bar',
+ version => 1.23,
+ abstract => undef,
+ author => ['Some Guy'],
+ license => 'unknown',
+ distribution_type => 'script',
+
+ configure_requires => {
+ Stuff => 2.34,
+ },
+ requires => {
+ Foo => 2.34,
+ Bar => 4.56,
+ },
+
+ no_index => {
+ directory => [qw(t inc)],
+ package => 'Thing',
+ },
+
+ generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
+ 'meta-spec' => {
+ url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
+ version => 1.4
+ },
+
+ wibble => 23,
+ wobble => 42,
+ ];
+}
diff --git a/lib/ExtUtils/t/metafile_file.t b/lib/ExtUtils/t/metafile_file.t
new file mode 100644
index 0000000000..6a67882933
--- /dev/null
+++ b/lib/ExtUtils/t/metafile_file.t
@@ -0,0 +1,293 @@
+#!/usr/bin/perl -w
+
+# This is a test of the fake YAML dumper implemented by EUMM:
+# ExtUtils::MM_Any::metafile_file
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use Test::More tests => 13;
+
+require ExtUtils::MM_Any;
+
+my $mm = bless {}, 'ExtUtils::MM_Any';
+
+{
+ my @meta = ( a => 1, b => 2 );
+ my $expected = <<YAML;
+--- #YAML:1.0
+a: 1
+b: 2
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "dump for flat hashes works ok");
+}
+
+{
+ my @meta = ( k1 => 'some key and value', k2 => undef, k3 => 1 );
+ my $expected = <<YAML;
+--- #YAML:1.0
+k1: some key and value
+k2: ~
+k3: 1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "dumping strings and undefs is ok");
+}
+
+{
+ my @meta = ( a => 1, b => 2, h => { hh => 1 } );
+ my $expected = <<YAML;
+--- #YAML:1.0
+a: 1
+b: 2
+h:
+ hh: 1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "dump for nested hashes works ok");
+}
+
+{
+ my @meta = ( a => 1, b => 2, h => { h1 => 'x', h2 => 'z' } );
+ my $expected = <<YAML;
+--- #YAML:1.0
+a: 1
+b: 2
+h:
+ h1: x
+ h2: z
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "nested hashes sort ascii-betically");
+ # to tell the truth, they sort case-insensitively
+ # that's hard to test for Perl with unstable sort's
+}
+
+{
+ my @meta = ( a => 1, b => 2, h => { hh => { hhh => 1 } } );
+ my $expected = <<YAML;
+--- #YAML:1.0
+a: 1
+b: 2
+h:
+ hh:
+ hhh: 1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "dump for hashes (with more nesting) works ok");
+}
+
+{
+ my @meta = ( a => 1, k => [ qw(w y z) ] );
+ my $expected = <<YAML;
+--- #YAML:1.0
+a: 1
+k:
+ - w
+ - y
+ - z
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "array of strings are handled ok");
+}
+
+is($mm->metafile_file( a => {}, b => [], c => undef ), <<'YAML', 'empty hashes and arrays');
+--- #YAML:1.0
+a: {}
+b: []
+c: ~
+YAML
+
+
+{
+ my @meta = (
+ name => 'My-Module',
+ version => '0.1',
+ version_from => 'lib/My/Module.pm',
+ installdirs => 'site',
+ abstract => 'A does-it-all module',
+ license => 'perl',
+ generated_by => 'myself',
+ author => 'John Doe <doe@doeland.org>',
+ distribution_type => 'module',
+ requires => {
+ 'My::Module::Helper' => 0,
+ 'Your::Module' => '1.5',
+ },
+ 'meta-spec' => {
+ version => '1.1',
+ url => 'http://module-build.sourceforge.net/META-spec-new.html',
+ },
+ );
+ my $expected = <<'YAML';
+--- #YAML:1.0
+name: My-Module
+version: 0.1
+version_from: lib/My/Module.pm
+installdirs: site
+abstract: A does-it-all module
+license: perl
+generated_by: myself
+author: John Doe <doe@doeland.org>
+distribution_type: module
+requires:
+ My::Module::Helper: 0
+ Your::Module: 1.5
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-new.html
+ version: 1.1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "dump for something like META.yml works");
+}
+
+{
+ my @meta = (
+ name => 'My-Module',
+ version => '0.1',
+ version_from => 'lib/My/Module.pm',
+ installdirs => 'site',
+ abstract => 'A does-it-all module',
+ license => 'perl',
+ generated_by => 'myself',
+ author => 'John Doe <doe@doeland.org>',
+ distribution_type => 'module',
+ requires => {
+ 'My::Module::Helper' => 0,
+ 'Your::Module' => '1.5',
+ },
+ recommends => {
+ 'Test::More' => 0,
+ 'Test::Pod' => 1.18,
+ 'Test::Pod::Coverage' => 1
+ },
+ 'meta-spec' => {
+ version => '1.1',
+ url => 'http://module-build.sourceforge.net/META-spec-new.html',
+ },
+ );
+ my $expected = <<'YAML';
+--- #YAML:1.0
+name: My-Module
+version: 0.1
+version_from: lib/My/Module.pm
+installdirs: site
+abstract: A does-it-all module
+license: perl
+generated_by: myself
+author: John Doe <doe@doeland.org>
+distribution_type: module
+requires:
+ My::Module::Helper: 0
+ Your::Module: 1.5
+recommends:
+ Test::More: 0
+ Test::Pod: 1.18
+ Test::Pod::Coverage: 1
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-new.html
+ version: 1.1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "META.yml with extra 'recommends' works");
+}
+
+{
+ my @meta = (
+ name => 'My-Module',
+ version => '0.1',
+ version_from => 'lib/My/Module.pm',
+ installdirs => 'site',
+ abstract => 'A does-it-all module',
+ license => 'perl',
+ generated_by => 'myself',
+ author => 'John Doe <doe@doeland.org>',
+ distribution_type => 'module',
+ requires => {
+ 'My::Module::Helper' => 0,
+ 'Your::Module' => '1.5',
+ },
+ recommends => {
+ 'Test::More' => 0,
+ 'Test::Pod' => 1.18,
+ 'Test::Pod::Coverage' => 1
+ },
+ no_index => {
+ dir => [ qw(inc) ],
+ file => [ qw(TODO NOTES) ],
+ },
+ 'meta-spec' => {
+ version => '1.1',
+ url => 'http://module-build.sourceforge.net/META-spec-new.html',
+ },
+ );
+ my $expected = <<'YAML';
+--- #YAML:1.0
+name: My-Module
+version: 0.1
+version_from: lib/My/Module.pm
+installdirs: site
+abstract: A does-it-all module
+license: perl
+generated_by: myself
+author: John Doe <doe@doeland.org>
+distribution_type: module
+requires:
+ My::Module::Helper: 0
+ Your::Module: 1.5
+recommends:
+ Test::More: 0
+ Test::Pod: 1.18
+ Test::Pod::Coverage: 1
+no_index:
+ dir:
+ - inc
+ file:
+ - TODO
+ - NOTES
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-new.html
+ version: 1.1
+YAML
+
+ is($mm->metafile_file(@meta), $expected, "META.yml with extra 'no_index' works");
+}
+
+{
+ my @meta = ( k => 'a : b', 'x : y' => 1 );
+ my $expected = <<YAML;
+--- #YAML:1.0
+k: a : b
+x : y: 1
+YAML
+ # NOTE: the output is not YAML-equivalent to the input
+
+ is($mm->metafile_file(@meta), $expected, "no quoting is done");
+}
+
+{
+ my @meta = ( k => \*STDOUT );
+ eval { $mm->metafile_file(@meta) };
+
+ like($@, qr/^only nested hashes, arrays and objects are supported/,
+ "we don't like but hash/array refs");
+}
+
+{
+ my @meta = ( k => [ [] ] );
+ eval { $mm->metafile_file(@meta) };
+
+ like($@, qr/^only nested arrays of non-refs are supported/,
+ "we also don't like but array of strings");
+}
+
+# recursive data structures: don't even think about it - endless recursion
diff --git a/lib/ExtUtils/t/writemakefile_args.t b/lib/ExtUtils/t/writemakefile_args.t
index da274d6cc7..efe104d0cd 100644
--- a/lib/ExtUtils/t/writemakefile_args.t
+++ b/lib/ExtUtils/t/writemakefile_args.t
@@ -14,7 +14,7 @@ BEGIN {
}
use strict;
-use Test::More tests => 28;
+use Test::More tests => 30;
use TieOut;
use MakeMaker::Test::Utils;
@@ -126,8 +126,8 @@ VERIFY
$warnings = '';
eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => [1,2,3],
+ NAME => 'Big::Dummy',
+ VERSION => [1,2,3],
);
};
like( $warnings, qr{^WARNING: VERSION takes a version object or string/number} );
@@ -135,8 +135,8 @@ VERIFY
$warnings = '';
eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => 1.002_003,
+ NAME => 'Big::Dummy',
+ VERSION => 1.002_003,
);
};
is( $warnings, '' );
@@ -145,8 +145,8 @@ VERIFY
$warnings = '';
eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => '1.002_003',
+ NAME => 'Big::Dummy',
+ VERSION => '1.002_003',
);
};
is( $warnings, '' );
@@ -156,39 +156,39 @@ VERIFY
$warnings = '';
eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => bless {}, "Some::Class",
+ NAME => 'Big::Dummy',
+ VERSION => bless {}, "Some::Class",
);
};
like( $warnings, '/^WARNING: VERSION takes a version object or string/number not a Some::Class object/' );
SKIP: {
- skip("Can't test version objects",6) unless eval { require version };
+ skip("Can't test version objects", 8) unless eval { require version };
version->import;
my $version = version->new("1.2.3");
$warnings = '';
- eval {
+ ok eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => $version,
+ NAME => 'Big::Dummy',
+ VERSION => $version,
);
- };
+ } || diag $@;
is( $warnings, '' );
isa_ok( $mm->{VERSION}, 'version' );
is( $mm->{VERSION}, $version );
$warnings = '';
$version = qv('1.2.3');
- eval {
+ ok eval {
$mm = WriteMakefile(
- NAME => 'Big::Dummy',
- VERSION => $version,
+ NAME => 'Big::Dummy',
+ VERSION => $version,
);
- };
+ } || diag $@;
is( $warnings, '' );
isa_ok( $mm->{VERSION}, 'version' );
is( $mm->{VERSION}, $version );
}
-} \ No newline at end of file
+}