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