Upgrade to MakeMaker 5.91_02, from Michael Schwern.
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / 00setup_dummy.t
1 #!/usr/bin/perl -w
2
3 BEGIN {
4     if( $ENV{PERL_CORE} ) {
5         @INC = ('../lib', 'lib');
6     }
7     else {
8         unshift @INC, 't/lib';
9     }
10 }
11 chdir 't';
12
13 use strict;
14 use Test::More tests => 7;
15 use File::Path;
16 use File::Basename;
17
18 my %Files = (
19              'Big-Dummy/lib/Big/Dummy.pm'     => <<'END',
20 package Big::Dummy;
21
22 $VERSION = 0.01;
23
24 1;
25 END
26
27              'Big-Dummy/Makefile.PL'          => <<'END',
28 use ExtUtils::MakeMaker;
29
30 printf "Current package is: %s\n", __PACKAGE__;
31
32 WriteMakefile(
33     NAME          => 'Big::Dummy',
34     VERSION_FROM  => 'lib/Big/Dummy.pm',
35     PREREQ_PM     => {},
36 );
37 END
38
39              'Big-Dummy/Liar/lib/Big/Liar.pm' => <<'END',
40 package Big::Liar;
41
42 $VERSION = 0.01;
43
44 1;
45 END
46
47              'Big-Dummy/Liar/Makefile.PL'     => <<'END',
48 use ExtUtils::MakeMaker;
49
50 my $mm = WriteMakefile(
51               NAME => 'Big::Liar',
52               VERSION_FROM => 'lib/Big/Liar.pm',
53               _KEEP_AFTER_FLUSH => 1
54              );
55
56 print "Big::Liar's vars\n";
57 foreach my $key (qw(INST_LIB INST_ARCHLIB)) {
58     print "$key = $mm->{$key}\n";
59 }
60 END
61
62              'Problem-Module/Makefile.PL'   => <<'END',
63 use ExtUtils::MakeMaker;
64
65 WriteMakefile(
66     NAME    => 'Problem::Module',
67 );
68 END
69
70              'Problem-Module/subdir/Makefile.PL'    => <<'END',
71 printf "\@INC %s .\n", (grep { $_ eq '.' } @INC) ? "has" : "doesn't have";
72
73 warn "I think I'm going to be sick\n";
74 die "YYYAaaaakkk\n";
75 END
76
77             );
78
79 while(my($file, $text) = each %Files) {
80     my $dir = dirname($file);
81     mkpath $dir;
82     open(FILE, ">$file");
83     print FILE $text;
84     close FILE;
85
86     ok( -e $file, "$file created" );
87 }
88
89
90 pass("Setup done");