ExtUtils::MakeMaker 6.03 -> 6.06_05ish
[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 => 9;
15 use File::Basename;
16 use File::Path;
17 use File::Spec;
18
19 my %Files = (
20              'Big-Dummy/lib/Big/Dummy.pm'     => <<'END',
21 package Big::Dummy;
22
23 $VERSION = 0.01;
24
25 =head1 NAME
26
27 Big::Dummy - Try "our" hot dog's
28
29 =cut
30
31 1;
32 END
33
34              'Big-Dummy/Makefile.PL'          => <<'END',
35 use ExtUtils::MakeMaker;
36
37 printf "Current package is: %s\n", __PACKAGE__;
38
39 WriteMakefile(
40     NAME          => 'Big::Dummy',
41     VERSION_FROM  => 'lib/Big/Dummy.pm',
42     PREREQ_PM     => { strict => 0 },
43     ABSTRACT_FROM => 'lib/Big/Dummy.pm',
44     AUTHOR        => 'Michael G Schwern <schwern@pobox.com>',
45 );
46 END
47
48              'Big-Dummy/t/compile.t'          => <<'END',
49 print "1..2\n";
50
51 print eval "use Big::Dummy; 1;" ? "ok 1\n" : "not ok 1\n";
52 print "ok 2 - TEST_VERBOSE\n";
53 END
54
55              'Big-Dummy/Liar/t/sanity.t'      => <<'END',
56 print "1..3\n";
57
58 print eval "use Big::Dummy; 1;" ? "ok 1\n" : "not ok 1\n";
59 print eval "use Big::Liar; 1;" ? "ok 2\n" : "not ok 2\n";
60 print "ok 3 - TEST_VERBOSE\n";
61 END
62
63              'Big-Dummy/Liar/lib/Big/Liar.pm' => <<'END',
64 package Big::Liar;
65
66 $VERSION = 0.01;
67
68 1;
69 END
70
71              'Big-Dummy/Liar/Makefile.PL'     => <<'END',
72 use ExtUtils::MakeMaker;
73
74 my $mm = WriteMakefile(
75               NAME => 'Big::Liar',
76               VERSION_FROM => 'lib/Big/Liar.pm',
77               _KEEP_AFTER_FLUSH => 1
78              );
79
80 print "Big::Liar's vars\n";
81 foreach my $key (qw(INST_LIB INST_ARCHLIB)) {
82     print "$key = $mm->{$key}\n";
83 }
84 END
85
86              'Problem-Module/Makefile.PL'   => <<'END',
87 use ExtUtils::MakeMaker;
88
89 WriteMakefile(
90     NAME    => 'Problem::Module',
91 );
92 END
93
94              'Problem-Module/subdir/Makefile.PL'    => <<'END',
95 printf "\@INC %s .\n", (grep { $_ eq '.' } @INC) ? "has" : "doesn't have";
96
97 warn "I think I'm going to be sick\n";
98 die "YYYAaaaakkk\n";
99 END
100
101             );
102
103 while(my($file, $text) = each %Files) {
104     # Convert to a relative, native file path.
105     $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
106
107     my $dir = dirname($file);
108     mkpath $dir;
109     open(FILE, ">$file");
110     print FILE $text;
111     close FILE;
112
113     ok( -e $file, "$file created" );
114 }
115
116
117 pass("Setup done");