Upgrade to ExtUtils-MakeMaker-6.46
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / metafile_data.t
1 BEGIN {
2     if( $ENV{PERL_CORE} ) {
3         chdir 't' if -d 't';
4         @INC = ('../lib', 'lib');
5     }
6     else {
7         unshift @INC, 't/lib';
8     }
9 }
10
11 use strict;
12 use Test::More tests => 3;
13
14 use Data::Dumper;
15
16 require ExtUtils::MM_Any;
17
18 my $new_mm = sub {
19     return bless {@_}, 'ExtUtils::MM_Any';
20 };
21
22 {
23     my $mm = $new_mm->(
24         DISTNAME        => 'Foo-Bar',
25         VERSION         => 1.23,
26         PM              => {
27             "Foo::Bar"          => 'lib/Foo/Bar.pm',
28         },
29     );
30
31     is_deeply [$mm->metafile_data], [
32         name            => 'Foo-Bar',
33         version         => 1.23,
34         abstract        => undef,
35         author          => [],
36         license         => 'unknown',
37         distribution_type       => 'module',
38
39         configure_requires      => {
40             'ExtUtils::MakeMaker'       => 0,
41         },
42
43         no_index        => {
44             directory           => [qw(t inc)],
45         },
46
47         generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
48         'meta-spec'  => {
49             url         => 'http://module-build.sourceforge.net/META-spec-v1.4.html', 
50             version     => 1.4
51         },
52     ];
53
54
55     is_deeply [$mm->metafile_data({}, { no_index => { directory => [qw(foo)] } })], [
56         name            => 'Foo-Bar',
57         version         => 1.23,
58         abstract        => undef,
59         author          => [],
60         license         => 'unknown',
61         distribution_type       => 'module',
62
63         configure_requires      => {
64             'ExtUtils::MakeMaker'       => 0,
65         },
66
67         no_index        => {
68             directory           => [qw(t inc foo)],
69         },
70
71         generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
72         'meta-spec'  => {
73             url         => 'http://module-build.sourceforge.net/META-spec-v1.4.html', 
74             version     => 1.4
75         },
76     ], 'rt.cpan.org 39348';
77 }
78
79
80 {
81     my $mm = $new_mm->(
82         DISTNAME        => 'Foo-Bar',
83         VERSION         => 1.23,
84         AUTHOR          => 'Some Guy',
85         PREREQ_PM       => {
86             Foo                 => 2.34,
87             Bar                 => 4.56,
88         },
89     );
90
91     is_deeply [$mm->metafile_data(
92         {
93             configure_requires => {
94                 Stuff   => 2.34
95             },
96             wobble      => 42
97         },
98         {
99             no_index    => {
100                 package => "Thing"
101             },
102             wibble      => 23
103         },
104     )],
105     [
106         name            => 'Foo-Bar',
107         version         => 1.23,
108         abstract        => undef,
109         author          => ['Some Guy'],
110         license         => 'unknown',
111         distribution_type       => 'script',
112
113         configure_requires      => {
114             Stuff       => 2.34,
115         },
116         requires       => {
117             Foo                 => 2.34,
118             Bar                 => 4.56,
119         },
120
121         no_index        => {
122             directory           => [qw(t inc)],
123             package             => 'Thing',
124         },
125
126         generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
127         'meta-spec'  => {
128             url         => 'http://module-build.sourceforge.net/META-spec-v1.4.html', 
129             version     => 1.4
130         },
131
132         wibble  => 23,
133         wobble  => 42,
134     ];
135 }