Commit | Line | Data |
45bc4d3a |
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; |
57b1a898 |
14 | use Test::More tests => 9; |
45bc4d3a |
15 | use File::Basename; |
d5d4ec93 |
16 | use File::Path; |
17 | use File::Spec; |
45bc4d3a |
18 | |
19 | my %Files = ( |
d5d4ec93 |
20 | 'Big-Dummy/lib/Big/Dummy.pm' => <<'END', |
45bc4d3a |
21 | package Big::Dummy; |
22 | |
23 | $VERSION = 0.01; |
24 | |
25 | 1; |
26 | END |
27 | |
d5d4ec93 |
28 | 'Big-Dummy/Makefile.PL' => <<'END', |
45bc4d3a |
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 | |
d5d4ec93 |
40 | 'Big-Dummy/t/compile.t' => <<'END', |
57b1a898 |
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 | |
d5d4ec93 |
47 | 'Big-Dummy/Liar/t/sanity.t' => <<'END', |
57b1a898 |
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 | |
d5d4ec93 |
55 | 'Big-Dummy/Liar/lib/Big/Liar.pm' => <<'END', |
45bc4d3a |
56 | package Big::Liar; |
57 | |
58 | $VERSION = 0.01; |
59 | |
60 | 1; |
61 | END |
62 | |
d5d4ec93 |
63 | 'Big-Dummy/Liar/Makefile.PL' => <<'END', |
45bc4d3a |
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 | |
d5d4ec93 |
78 | 'Problem-Module/Makefile.PL' => <<'END', |
45bc4d3a |
79 | use ExtUtils::MakeMaker; |
80 | |
81 | WriteMakefile( |
82 | NAME => 'Problem::Module', |
83 | ); |
84 | END |
85 | |
d5d4ec93 |
86 | 'Problem-Module/subdir/Makefile.PL' => <<'END', |
45bc4d3a |
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) { |
d5d4ec93 |
96 | # Convert to a relative, native file path. |
97 | $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file); |
98 | |
45bc4d3a |
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"); |