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