Upgrade to ExtUtils::MakeMaker 6.52
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / basic_finish.pl
CommitLineData
4954abf7 1# *NOTE* This is executed by basic.t and is included in both ExtUtils-MakeMaker
2# as well as Perlcore. Note also that it is expected to be executed in a do "FILE"
3# immediately after basic.plt is executed (similarly).
4
5# It is NOT expected to be executed under ExtUtils-Install alone, and in fact is not
6# distributed there, however it is expected to be executed under ExtUtils-MakeMaker
7# and Perl itself.
8
9my $dist_test_out = run("$make disttest");
10is( $?, 0, 'disttest' ) || diag($dist_test_out);
11
12# Test META.yml generation
13use ExtUtils::Manifest qw(maniread);
14
15my $distdir = 'Big-Dummy-0.01';
16$distdir =~ s/\./_/g if $Is_VMS;
17my $meta_yml = "$distdir/META.yml";
18
19ok( !-f 'META.yml', 'META.yml not written to source dir' );
20ok( -f $meta_yml, 'META.yml written to dist dir' );
21ok( !-e "META_new.yml", 'temp META.yml file not left around' );
22
23SKIP: {
24 # META.yml spec 1.4 was added in 0.11
25 skip "Test::YAML::Meta >= 0.11 required", 2
26 unless eval { require Test::YAML::Meta } and
27 Test::YAML::Meta->VERSION >= 0.11;
28
29 Test::YAML::Meta::meta_spec_ok($meta_yml);
30}
31
32ok open META, $meta_yml or diag $!;
33my $meta = join '', <META>;
34ok close META;
35
36is $meta, <<"END";
37--- #YAML:1.0
38name: Big-Dummy
39version: 0.01
40abstract: Try "our" hot dog's
41author:
42 - Michael G Schwern <schwern\@pobox.com>
43license: unknown
44distribution_type: module
45configure_requires:
46 ExtUtils::MakeMaker: 0
47requires:
48 strict: 0
49no_index:
50 directory:
51 - t
52 - inc
53generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION
54meta-spec:
55 url: http://module-build.sourceforge.net/META-spec-v1.4.html
56 version: 1.4
57END
58
59my $manifest = maniread("$distdir/MANIFEST");
60# VMS is non-case preserving, so we can't know what the MANIFEST will
61# look like. :(
62_normalize($manifest);
63is( $manifest->{'meta.yml'}, 'Module meta-data (added by MakeMaker)' );
64
65
66# Test NO_META META.yml suppression
67unlink $meta_yml;
68ok( !-f $meta_yml, 'META.yml deleted' );
69@mpl_out = run(qq{$perl Makefile.PL "NO_META=1"});
70cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out);
71my $distdir_out = run("$make distdir");
72is( $?, 0, 'distdir' ) || diag($distdir_out);
73ok( !-f $meta_yml, 'META.yml generation suppressed by NO_META' );
74
75
76# Make sure init_dirscan doesn't go into the distdir
77@mpl_out = run(qq{$perl Makefile.PL "PREFIX=../dummy-install"});
78
79cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out);
80
81ok( grep(/^Writing $makefile for Big::Dummy/, @mpl_out) == 1,
82 'init_dirscan skipped distdir') ||
83 diag(@mpl_out);
84
85# I know we'll get ignored errors from make here, that's ok.
86# Send STDERR off to oblivion.
87open(SAVERR, ">&STDERR") or die $!;
88open(STDERR, ">".File::Spec->devnull) or die $!;
89
90my $realclean_out = run("$make realclean");
91is( $?, 0, 'realclean' ) || diag($realclean_out);
92
93open(STDERR, ">&SAVERR") or die $!;
94close SAVERR;
95
96
97sub _normalize {
98 my $hash = shift;
99
100 while(my($k,$v) = each %$hash) {
101 delete $hash->{$k};
102 $hash->{lc $k} = $v;
103 }
104}