Integrate mailine
[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::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/t/compile.t'          => <<'END',
40 print "1..2\n";
41
42 print eval "use Big::Dummy; 1;" ? "ok 1\n" : "not ok 1\n";
43 print "ok 2 - TEST_VERBOSE\n";
44 END
45
46              'Big-Dummy/Liar/t/sanity.t'      => <<'END',
47 print "1..3\n";
48
49 print eval "use Big::Dummy; 1;" ? "ok 1\n" : "not ok 1\n";
50 print eval "use Big::Liar; 1;" ? "ok 2\n" : "not ok 2\n";
51 print "ok 3 - TEST_VERBOSE\n";
52 END
53
54              'Big-Dummy/Liar/lib/Big/Liar.pm' => <<'END',
55 package Big::Liar;
56
57 $VERSION = 0.01;
58
59 1;
60 END
61
62              'Big-Dummy/Liar/Makefile.PL'     => <<'END',
63 use ExtUtils::MakeMaker;
64
65 my $mm = WriteMakefile(
66               NAME => 'Big::Liar',
67               VERSION_FROM => 'lib/Big/Liar.pm',
68               _KEEP_AFTER_FLUSH => 1
69              );
70
71 print "Big::Liar's vars\n";
72 foreach my $key (qw(INST_LIB INST_ARCHLIB)) {
73     print "$key = $mm->{$key}\n";
74 }
75 END
76
77              'Problem-Module/Makefile.PL'   => <<'END',
78 use ExtUtils::MakeMaker;
79
80 WriteMakefile(
81     NAME    => 'Problem::Module',
82 );
83 END
84
85              'Problem-Module/subdir/Makefile.PL'    => <<'END',
86 printf "\@INC %s .\n", (grep { $_ eq '.' } @INC) ? "has" : "doesn't have";
87
88 warn "I think I'm going to be sick\n";
89 die "YYYAaaaakkk\n";
90 END
91
92             );
93
94 while(my($file, $text) = each %Files) {
95     my $dir = dirname($file);
96     mkpath $dir;
97     open(FILE, ">$file");
98     print FILE $text;
99     close FILE;
100
101     ok( -e $file, "$file created" );
102 }
103
104
105 pass("Setup done");