Embedding
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / 00setup_dummy.t
CommitLineData
45bc4d3a 1#!/usr/bin/perl -w
2
3BEGIN {
4 if( $ENV{PERL_CORE} ) {
5 @INC = ('../lib', 'lib');
6 }
7 else {
8 unshift @INC, 't/lib';
9 }
10}
11chdir 't';
12
13use strict;
57b1a898 14use Test::More tests => 9;
45bc4d3a 15use File::Basename;
d5d4ec93 16use File::Path;
17use File::Spec;
45bc4d3a 18
19my %Files = (
d5d4ec93 20 'Big-Dummy/lib/Big/Dummy.pm' => <<'END',
45bc4d3a 21package Big::Dummy;
22
23$VERSION = 0.01;
24
479d2113 25=head1 NAME
26
27Big::Dummy - Try "our" hot dog's
28
29=cut
30
45bc4d3a 311;
32END
33
d5d4ec93 34 'Big-Dummy/Makefile.PL' => <<'END',
45bc4d3a 35use ExtUtils::MakeMaker;
36
37printf "Current package is: %s\n", __PACKAGE__;
38
39WriteMakefile(
40 NAME => 'Big::Dummy',
41 VERSION_FROM => 'lib/Big/Dummy.pm',
479d2113 42 PREREQ_PM => { strict => 0 },
43 ABSTRACT_FROM => 'lib/Big/Dummy.pm',
44 AUTHOR => 'Michael G Schwern <schwern@pobox.com>',
45bc4d3a 45);
46END
47
d5d4ec93 48 'Big-Dummy/t/compile.t' => <<'END',
57b1a898 49print "1..2\n";
50
51print eval "use Big::Dummy; 1;" ? "ok 1\n" : "not ok 1\n";
52print "ok 2 - TEST_VERBOSE\n";
53END
54
d5d4ec93 55 'Big-Dummy/Liar/t/sanity.t' => <<'END',
57b1a898 56print "1..3\n";
57
58print eval "use Big::Dummy; 1;" ? "ok 1\n" : "not ok 1\n";
59print eval "use Big::Liar; 1;" ? "ok 2\n" : "not ok 2\n";
60print "ok 3 - TEST_VERBOSE\n";
61END
62
d5d4ec93 63 'Big-Dummy/Liar/lib/Big/Liar.pm' => <<'END',
45bc4d3a 64package Big::Liar;
65
66$VERSION = 0.01;
67
681;
69END
70
d5d4ec93 71 'Big-Dummy/Liar/Makefile.PL' => <<'END',
45bc4d3a 72use ExtUtils::MakeMaker;
73
74my $mm = WriteMakefile(
75 NAME => 'Big::Liar',
76 VERSION_FROM => 'lib/Big/Liar.pm',
77 _KEEP_AFTER_FLUSH => 1
78 );
79
80print "Big::Liar's vars\n";
81foreach my $key (qw(INST_LIB INST_ARCHLIB)) {
82 print "$key = $mm->{$key}\n";
83}
84END
85
d5d4ec93 86 'Problem-Module/Makefile.PL' => <<'END',
45bc4d3a 87use ExtUtils::MakeMaker;
88
89WriteMakefile(
90 NAME => 'Problem::Module',
91);
92END
93
d5d4ec93 94 'Problem-Module/subdir/Makefile.PL' => <<'END',
45bc4d3a 95printf "\@INC %s .\n", (grep { $_ eq '.' } @INC) ? "has" : "doesn't have";
96
97warn "I think I'm going to be sick\n";
98die "YYYAaaaakkk\n";
99END
100
101 );
102
103while(my($file, $text) = each %Files) {
d5d4ec93 104 # Convert to a relative, native file path.
105 $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
106
45bc4d3a 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
117pass("Setup done");