I think this is quite enough testing for a deprecated feature.
[p5sagit/p5-mst-13.2.git] / t / lib / 1_compile.t
1 #!./perl
2
3 BEGIN {
4     chdir '..' if -d '../pod' && -d '../t';
5     @INC = 'lib';
6 }
7
8 use strict;
9 use warnings;
10 use Config;
11
12 my %Core_Modules;
13
14 unless (open(MANIFEST, "MANIFEST")) {
15     die "$0: failed to open 'MANIFEST': $!\n";
16 }
17
18 sub add_by_name {
19     $Core_Modules{$_[0]}++;
20 }
21
22 while (<MANIFEST>) {
23     next unless m!^lib/(\S+?)\.pm!;
24     my $module = $1;
25     $module =~ s!/!::!g;
26     add_by_name($module);
27 }
28
29 close(MANIFEST);
30
31 # Delete stuff that can't be tested here.
32
33 sub delete_by_name {
34     delete $Core_Modules{$_[0]};
35 }
36
37 sub has_extension {
38     $Config{extensions} =~ /\b$_[0]\b/i;
39 }
40
41 sub delete_unless_has_extension {
42     delete $Core_Modules{$_[0]} unless has_extension($_[0]);
43 }
44
45 foreach my $known_extension (split(' ', $Config{known_extensions})) {
46     delete_unless_has_extension($known_extension);
47 }
48
49 sub delete_by_prefix {
50     for my $match (grep { /^$_[0]/ } keys %Core_Modules) {
51         delete_by_name($match);
52     }
53 }
54
55 delete_by_name('CGI::Fast');            # won't load without FCGI
56
57 delete_by_name('Devel::DProf');         # needs to be run as -d:DProf
58
59 delete_by_prefix('ExtUtils::MM_');      # ExtUtils::MakeMaker's domain
60
61 delete_by_prefix('File::Spec::');       # File::Spec's domain
62 add_by_name('File::Spec::Functions');   # put this back
63
64 sub using_feature {
65     my $use = "use$_[0]";
66     exists $Config{$use} &&
67         defined $Config{$use} &&
68         $Config{$use} eq 'define';
69 }
70
71 unless (using_feature('threads') && has_extension('Thread')) {
72     delete_by_name('Thread');
73     delete_by_prefix('Thread::');
74 }
75
76 delete_by_prefix('unicode::');
77 add_by_name('unicode::distinct');       # put this back
78
79
80 # Delete all modules which have their own tests.  This makes
81 # this test a lot faster.
82 foreach my $mod (<DATA>) {
83     chomp $mod;
84     delete_by_name($mod);
85 }
86
87 # Okay, this is the list.
88
89 my @Core_Modules = sort keys %Core_Modules;
90
91 print "1..".@Core_Modules."\n";
92
93 my $test_num = 1;
94
95 foreach my $module (@Core_Modules) {
96     print "# $module compile failed\nnot " unless compile_module($module);
97     print "ok $test_num\n";
98     $test_num++;
99 }
100
101 # We do this as a separate process else we'll blow the hell
102 # out of our namespace.
103 sub compile_module {
104     my ($module) = $_[0];
105     
106     return scalar `$^X "-Ilib" t/lib/compmod.pl $module` =~ /^ok/;
107 }
108
109 __DATA__
110 AnyDBM_File
111 AutoLoader
112 B
113 B::Debug
114 B::Deparse
115 B::ShowLex
116 B::Stash
117 Benchmark
118 CGI
119 CGI::Pretty
120 CGI::Util
121 Carp
122 Class::ISA
123 Class::Struct
124 CPAN
125 Cwd
126 DB_File
127 Data::Dumper
128 Devel::DProf
129 Devel::Peek
130 Devel::SelfStubber
131 Digest
132 Digest::MD5
133 DirHandle
134 Dumpvalue
135 Encode
136 English
137 Env
138 Errno
139 Exporter
140 Exporter::Heavy
141 Fatal
142 Fcntl
143 File::Basename
144 File::CheckTree
145 File::Copy
146 File::DosGlob
147 File::Find
148 File::Glob
149 File::Path
150 File::Spec
151 File::Spec::Functions
152 File::Temp
153 FileCache
154 FileHandle
155 Filter::Simple
156 Filter::Util::Call
157 FindBin
158 GDBM_File
159 Getopt::Long
160 Getopt::Std
161 I18N:Collate
162 IO::Dir
163 IO::File
164 IO::Handle
165 IO::Pipe
166 IO::Poll
167 IO::Seekable
168 IO::Select
169 IO::Socket
170 IO::Socket::INET
171 IO::Socket::UNIX
172 IPC::Open2
173 IPC::Open3
174 IPC::SysV
175 List::Util
176 Locale::Constants
177 Locale::Country
178 Locale::Currency
179 Locale::Language
180 MIME::Base64
181 MIME::QuotedPrint
182 Math::BigFloat
183 Math::BigInt
184 Math::Complex
185 Math::Trig
186 NDBM_File
187 NEXT
188 Net::hostent
189 ODBM_File
190 Opcode
191 POSIX
192 Pod::Checker
193 Pod::Find
194 Pod::Text
195 Pod::Usage
196 SDBM_File
197 Safe
198 Scalar::Util
199 Search::Dict
200 SelectSaver
201 SelfLoader
202 Socket
203 Storable
204 Switch
205 Symbol
206 Sys::Hostname
207 Sys::Syslog
208 Term::ANSIColor
209 Test
210 Test::Harness
211 Test::ParseWords
212 Text::Abbrev
213 Text::Balanced
214 Text::ParseWords
215 Text::Soundex
216 Text::Tabs
217 Text::Wrap
218 Thread
219 Tie::Array
220 Tie::Handle
221 Tie::Hash
222 Tie::RefHash
223 Tie::Scalar
224 Tie::SubstrHash
225 Time::HiRes
226 Time::Local
227 Time::Piece
228 UNIVERSAL
229 XS::Typemap
230 attrs
231 base
232 bytes
233 charnames
234 constant
235 diagnostics
236 fields
237 integer
238 locale
239 ops
240 overload
241 strict
242 subs
243 utf8
244 vars
245 warnings
246 warnings::register