[ID 20010711.005] in Tie::Array, SPLICE ignores context, breaking SHIFT
[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
bdc55ba4 111 return scalar `$^X "-Ilib" t/lib/compmod.pl $module` =~ /^ok/;
7200bc44 112}
6b40b044 113
20e80008 114# Add here modules that have their own test scripts and therefore
115# need not be test-compiled by 1_compile.t.
6b40b044 116__DATA__
117AnyDBM_File
dc6b6eef 118Attribute::Handlers
6b40b044 119AutoLoader
120B
121B::Debug
122B::Deparse
123B::ShowLex
124B::Stash
125Benchmark
126CGI
127CGI::Pretty
128CGI::Util
129Carp
20e80008 130Carp::Heavy
6b40b044 131Class::ISA
132Class::Struct
46700524 133CPAN
6b40b044 134Cwd
135DB_File
136Data::Dumper
137Devel::DProf
138Devel::Peek
7f4f6daf 139Devel::SelfStubber
6b40b044 140Digest
141Digest::MD5
142DirHandle
143Dumpvalue
144Encode
145English
146Env
147Errno
148Exporter
149Exporter::Heavy
20e80008 150ExtUtils::Constant
151ExtUtils::MakeMaker
6b40b044 152Fatal
153Fcntl
154File::Basename
155File::CheckTree
02c8fbd5 156File::Compare
6b40b044 157File::Copy
158File::DosGlob
159File::Find
160File::Glob
161File::Path
162File::Spec
163File::Spec::Functions
164File::Temp
f7a45afb 165File::stat
6b40b044 166FileCache
167FileHandle
7eade29f 168Filter::Simple
6b40b044 169Filter::Util::Call
170FindBin
171GDBM_File
172Getopt::Long
173Getopt::Std
d763e2de 174I18N::Langinfo
20e80008 175I18N::LangTags
176I18N::Collate
6b40b044 177IO::Dir
178IO::File
179IO::Handle
180IO::Pipe
181IO::Poll
182IO::Seekable
183IO::Select
184IO::Socket
185IO::Socket::INET
186IO::Socket::UNIX
187IPC::Open2
188IPC::Open3
189IPC::SysV
190List::Util
191Locale::Constants
192Locale::Country
193Locale::Currency
194Locale::Language
20e80008 195Locale::Maketext
6b40b044 196MIME::Base64
197MIME::QuotedPrint
198Math::BigFloat
199Math::BigInt
200Math::Complex
201Math::Trig
202NDBM_File
7eade29f 203NEXT
6b40b044 204Net::hostent
cdbd8744 205Net::netent
6fa754df 206Net::protoent
207Net::servent
6b40b044 208ODBM_File
209Opcode
20e80008 210PerlIO
6b40b044 211POSIX
212Pod::Checker
213Pod::Find
214Pod::Text
215Pod::Usage
216SDBM_File
217Safe
218Scalar::Util
219Search::Dict
220SelectSaver
221SelfLoader
222Socket
223Storable
224Switch
225Symbol
226Sys::Hostname
227Sys::Syslog
228Term::ANSIColor
229Test
230Test::Harness
231Test::ParseWords
232Text::Abbrev
233Text::Balanced
234Text::ParseWords
235Text::Soundex
236Text::Tabs
237Text::Wrap
238Thread
239Tie::Array
240Tie::Handle
241Tie::Hash
242Tie::RefHash
243Tie::Scalar
244Tie::SubstrHash
245Time::HiRes
246Time::Local
247Time::Piece
2857d2f7 248Time::gmtime
249Time::localtime
250Time::tm
d763e2de 251Unicode::UCD
6b40b044 252UNIVERSAL
6888c95f 253User::grent
c7506216 254User::pwent
6b40b044 255XS::Typemap
601f2d16 256attributes
6b40b044 257attrs
20e80008 258autouse
6b40b044 259base
260bytes
261charnames
262constant
263diagnostics
264fields
265integer
266locale
267ops
268overload
269strict
270subs
271utf8
6b40b044 272warnings
273warnings::register