diff options
Diffstat (limited to 'cpan/ExtUtils-MakeMaker/t/basic.t')
-rw-r--r-- | cpan/ExtUtils-MakeMaker/t/basic.t | 64 |
1 files changed, 62 insertions, 2 deletions
diff --git a/cpan/ExtUtils-MakeMaker/t/basic.t b/cpan/ExtUtils-MakeMaker/t/basic.t index 1842a1c839..9cd1d931c3 100644 --- a/cpan/ExtUtils-MakeMaker/t/basic.t +++ b/cpan/ExtUtils-MakeMaker/t/basic.t @@ -11,7 +11,7 @@ use strict; use Config; use ExtUtils::MakeMaker; -use Test::More tests => 80; +use Test::More tests => 98; use MakeMaker::Test::Utils; use MakeMaker::Test::Setup::BFD; use File::Find; @@ -229,18 +229,23 @@ use ExtUtils::Manifest qw(maniread); my $distdir = 'Big-Dummy-0.01'; $distdir =~ s/\./_/g if $Is_VMS; my $meta_yml = "$distdir/META.yml"; +my $mymeta_yml = "$distdir/MYMETA.yml"; 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' ); +ok( -f 'MYMETA.yml', 'MYMETA.yml is written to source dir' ); +ok( -f $mymeta_yml, 'MYMETA.yml is written to dist dir on disttest' ); + SKIP: { # META.yml spec 1.4 was added in 0.11 - skip "Test::YAML::Meta >= 0.11 required", 2 + skip "Test::YAML::Meta >= 0.11 required", 4 unless eval { require Test::YAML::Meta } and Test::YAML::Meta->VERSION >= 0.11; Test::YAML::Meta::meta_spec_ok($meta_yml); + Test::YAML::Meta::meta_spec_ok($mymeta_yml); } ok open META, $meta_yml or diag $!; @@ -272,6 +277,48 @@ meta-spec: version: 1.4 END +my $mymeta_expected_content=<<"END"; +--- +abstract: "Try \\"our\\" hot dog's" +author: + - 'Michael G Schwern <schwern\@pobox.com>' +build_requires: + warnings: 0 +configure_requires: + ExtUtils::MakeMaker: 0 +distribution_type: module +dynamic_config: 0 +generated_by: 'ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION' +license: unknown +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 +name: Big-Dummy +no_index: + directory: + - t + - inc +requires: + strict: 0 +version: 0.01 +END + +{ +ok open META, $mymeta_yml or diag $!; +my $mymeta_content = join '', <META>; +ok close META; + +is($mymeta_content,$mymeta_expected_content,"MYMETA.yml (using Parse::CPAN::Meta) content is correct"); +} + +{ +ok open META, 'MYMETA.yml' or diag $!; +my $mymeta_content = join '', <META>; +ok close META; + +is($mymeta_content,$mymeta_expected_content,"MYMETA.yml (generated from scratch)content is correct"); +} + my $manifest = maniread("$distdir/MANIFEST"); # VMS is non-case preserving, so we can't know what the MANIFEST will # look like. :( @@ -281,12 +328,25 @@ is( $manifest->{'meta.yml'}, 'Module meta-data (added by MakeMaker)' ); # Test NO_META META.yml suppression unlink $meta_yml; +unlink 'MYMETA.yml'; ok( !-f $meta_yml, 'META.yml deleted' ); +ok( !-f 'MYMETA.yml','MYMETA.yml deleted' ); @mpl_out = run(qq{$perl Makefile.PL "NO_META=1"}); +ok( -f 'MYMETA.yml', 'MYMETA.yml generation not suppressed by NO_META' ); cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); +ok( !-f $meta_yml, 'META.yml generation suppressed by NO_META' ); my $distdir_out = run("$make distdir"); is( $?, 0, 'distdir' ) || diag($distdir_out); ok( !-f $meta_yml, 'META.yml generation suppressed by NO_META' ); +unlink 'MYMETA.yml'; + +ok( !-f 'MYMETA.yml','MYMETA.yml deleted' ); +@mpl_out = run(qq{$perl Makefile.PL "NO_MYMETA=1"}); +cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); +$distdir_out = run("$make distdir"); +is( $?, 0, 'distdir' ) || diag($distdir_out); +ok( !-f 'MYMETA.yml','MYMETA.yml generation suppressed by NO_MYMETA' ); +ok( -f $meta_yml, 'META.yml generation not suppressed by NO_MYMETA' ); # Make sure init_dirscan doesn't go into the distdir |