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 | |
431b0fc4 |
19 | if( $^O eq 'VMS' ) { |
20 | # On older systems we might exceed the 8-level directory depth limit |
21 | # imposed by RMS. We get around this with a rooted logical, but we |
22 | # can't create logical names with attributes in Perl, so we do it |
23 | # in a DCL subprocess and put it in the job table so the parent sees it. |
24 | open( BFDTMP, '>bfdtesttmp.com' ) || die "Error creating command file; $!"; |
25 | print BFDTMP <<'COMMAND'; |
26 | $ BFD_TEST_ROOT = F$PARSE("SYS$DISK:[-]",,,,"NO_CONCEAL")-".][000000"-"]["-"].;"+".]" |
27 | $ DEFINE/JOB/NOLOG/TRANSLATION=CONCEALED BFD_TEST_ROOT 'BFD_TEST_ROOT' |
28 | COMMAND |
29 | close BFDTMP; |
30 | |
31 | system '@bfdtesttmp.com'; |
32 | 1 while unlink 'bfdtesttmp.com'; |
33 | } |
34 | |
35 | |
45bc4d3a |
36 | my %Files = ( |
d5d4ec93 |
37 | 'Big-Dummy/lib/Big/Dummy.pm' => <<'END', |
45bc4d3a |
38 | package Big::Dummy; |
39 | |
40 | $VERSION = 0.01; |
41 | |
479d2113 |
42 | =head1 NAME |
43 | |
44 | Big::Dummy - Try "our" hot dog's |
45 | |
46 | =cut |
47 | |
45bc4d3a |
48 | 1; |
49 | END |
50 | |
d5d4ec93 |
51 | 'Big-Dummy/Makefile.PL' => <<'END', |
45bc4d3a |
52 | use ExtUtils::MakeMaker; |
53 | |
2c91f887 |
54 | # This will interfere with the PREREQ_PRINT tests. |
55 | printf "Current package is: %s\n", __PACKAGE__ unless "@ARGV" =~ /PREREQ/; |
45bc4d3a |
56 | |
57 | WriteMakefile( |
58 | NAME => 'Big::Dummy', |
59 | VERSION_FROM => 'lib/Big/Dummy.pm', |
479d2113 |
60 | PREREQ_PM => { strict => 0 }, |
61 | ABSTRACT_FROM => 'lib/Big/Dummy.pm', |
62 | AUTHOR => 'Michael G Schwern <schwern@pobox.com>', |
45bc4d3a |
63 | ); |
64 | END |
65 | |
d5d4ec93 |
66 | 'Big-Dummy/t/compile.t' => <<'END', |
57b1a898 |
67 | print "1..2\n"; |
68 | |
69 | print eval "use Big::Dummy; 1;" ? "ok 1\n" : "not ok 1\n"; |
70 | print "ok 2 - TEST_VERBOSE\n"; |
71 | END |
72 | |
d5d4ec93 |
73 | 'Big-Dummy/Liar/t/sanity.t' => <<'END', |
57b1a898 |
74 | print "1..3\n"; |
75 | |
76 | print eval "use Big::Dummy; 1;" ? "ok 1\n" : "not ok 1\n"; |
77 | print eval "use Big::Liar; 1;" ? "ok 2\n" : "not ok 2\n"; |
78 | print "ok 3 - TEST_VERBOSE\n"; |
79 | END |
80 | |
d5d4ec93 |
81 | 'Big-Dummy/Liar/lib/Big/Liar.pm' => <<'END', |
45bc4d3a |
82 | package Big::Liar; |
83 | |
84 | $VERSION = 0.01; |
85 | |
86 | 1; |
87 | END |
88 | |
d5d4ec93 |
89 | 'Big-Dummy/Liar/Makefile.PL' => <<'END', |
45bc4d3a |
90 | use ExtUtils::MakeMaker; |
91 | |
92 | my $mm = WriteMakefile( |
93 | NAME => 'Big::Liar', |
94 | VERSION_FROM => 'lib/Big/Liar.pm', |
95 | _KEEP_AFTER_FLUSH => 1 |
96 | ); |
97 | |
98 | print "Big::Liar's vars\n"; |
99 | foreach my $key (qw(INST_LIB INST_ARCHLIB)) { |
100 | print "$key = $mm->{$key}\n"; |
101 | } |
102 | END |
103 | |
d5d4ec93 |
104 | 'Problem-Module/Makefile.PL' => <<'END', |
45bc4d3a |
105 | use ExtUtils::MakeMaker; |
106 | |
107 | WriteMakefile( |
108 | NAME => 'Problem::Module', |
109 | ); |
110 | END |
111 | |
d5d4ec93 |
112 | 'Problem-Module/subdir/Makefile.PL' => <<'END', |
45bc4d3a |
113 | printf "\@INC %s .\n", (grep { $_ eq '.' } @INC) ? "has" : "doesn't have"; |
114 | |
115 | warn "I think I'm going to be sick\n"; |
116 | die "YYYAaaaakkk\n"; |
117 | END |
118 | |
119 | ); |
120 | |
121 | while(my($file, $text) = each %Files) { |
d5d4ec93 |
122 | # Convert to a relative, native file path. |
123 | $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file); |
124 | |
45bc4d3a |
125 | my $dir = dirname($file); |
126 | mkpath $dir; |
127 | open(FILE, ">$file"); |
128 | print FILE $text; |
129 | close FILE; |
130 | |
131 | ok( -e $file, "$file created" ); |
132 | } |
133 | |
134 | |
135 | pass("Setup done"); |