This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
blib does have a detectable test.
[perl5.git] / t / lib / 1_compile.t
index 2670e7a..10fe381 100644 (file)
@@ -10,6 +10,7 @@ use warnings;
 use Config;
 
 my %Core_Modules;
+my %Test;
 
 unless (open(MANIFEST, "MANIFEST")) {
     die "$0: failed to open 'MANIFEST': $!\n";
@@ -20,10 +21,20 @@ sub add_by_name {
 }
 
 while (<MANIFEST>) {
-    next unless m!^lib/(\S+?)\.pm!;
-    my $module = $1;
-    $module =~ s!/!::!g;
-    add_by_name($module);
+    if (m!^(lib)/(\S+?)\.pm\s!) {
+       # Collecting modules names from under ext/ would be
+       # rather painful since the mapping from filenames
+       # to module names is not 100%.
+       my ($dir, $module) = ($1, $2);
+       $module =~ s!/!::!g;
+       add_by_name($module);
+    } elsif (m!^(lib|ext)/(\S+?)(?:\.t|/test.pl)\s!) {
+       my ($dir, $test) = ($1, $2);
+       $test =~ s!(\w+)/\1$!$1! if $dir eq 'ext';
+       $test =~ s!/t/[^/]+$!!;
+       $test =~ s!/!::!g;
+       $Test{$test}++;
+    }
 }
 
 close(MANIFEST);
@@ -61,6 +72,8 @@ delete_by_prefix('ExtUtils::MM_');    # ExtUtils::MakeMaker's domain
 delete_by_prefix('File::Spec::');      # File::Spec's domain
 add_by_name('File::Spec::Functions');  # put this back
 
+delete_by_prefix('Attribute::Handlers');# we test this, and we have demos
+
 sub using_feature {
     my $use = "use$_[0]";
     exists $Config{$use} &&
@@ -73,14 +86,20 @@ unless (using_feature('threads') && has_extension('Thread')) {
     delete_by_prefix('Thread::');
 }
 
-delete_by_prefix('unicode::');
-add_by_name('unicode::distinct');      # put this back
+unless (has_extension('NDBM_File')) {
+    delete_by_name('Memoize::NDBM_File');
+}
 
+delete_by_prefix('unicode::');
 
-# Delete all modules which have their own tests.  This makes
-# this test a lot faster.
+# Delete all modules which have their own tests.
+# This makes this test a lot faster.
+foreach my $mod (sort keys %Test) {
+    delete_by_name($mod);
+}
 foreach my $mod (<DATA>) {
     chomp $mod;
+    print "### $mod has a test but is in DATA\n" if exists $Test{$mod};
     delete_by_name($mod);
 }
 
@@ -93,7 +112,7 @@ print "1..".@Core_Modules."\n";
 my $test_num = 1;
 
 foreach my $module (@Core_Modules) {
-    print "$module compile failed\nnot " unless compile_module($module);
+    print "$module compile failed\nnot " unless compile_module($module);
     print "ok $test_num\n";
     $test_num++;
 }
@@ -103,69 +122,31 @@ foreach my $module (@Core_Modules) {
 sub compile_module {
     my ($module) = $_[0];
     
-    return scalar `$^X "-Ilib" t/lib/compmod.pl $module` =~ /^ok/;
+    my $out = scalar `$^X "-Ilib" t/lib/compmod.pl $module`;
+    print "# $out";
+    return $out =~ /^ok/;
 }
 
 # Add here modules that have their own test scripts and therefore
 # need not be test-compiled by 1_compile.t.
 __DATA__
-AnyDBM_File
-AutoLoader
-B
-B::Debug
-B::Deparse
 B::ShowLex
-B::Stash
-Benchmark
-CGI
+CGI::Apache
+CGI::Carp
+CGI::Cookie
+CGI::Form
 CGI::Pretty
+CGI::Switch
 CGI::Util
-Carp
 Carp::Heavy
-Class::ISA
-Class::Struct
-CPAN
-Cwd
-DB_File
-Data::Dumper
 Devel::DProf
-Devel::Peek
-Devel::SelfStubber
-Digest
-Digest::MD5
-DirHandle
 Dumpvalue
-Encode
-English
-Env
-Errno
-Exporter
 Exporter::Heavy
 ExtUtils::Constant
 ExtUtils::MakeMaker
-Fatal
-Fcntl
-File::Basename
-File::CheckTree
-File::Copy
-File::DosGlob
-File::Find
-File::Glob
-File::Path
-File::Spec
-File::Spec::Functions
-File::Temp
-File::stat
-FileCache
-FileHandle
-Filter::Simple
 Filter::Util::Call
-FindBin
 GDBM_File
-Getopt::Long
-Getopt::Std
-I18N::LangTags
-I18N::Collate
+I18N::LangTags::List
 IO::Dir
 IO::File
 IO::Handle
@@ -176,31 +157,22 @@ IO::Select
 IO::Socket
 IO::Socket::INET
 IO::Socket::UNIX
-IPC::Open2
-IPC::Open3
-IPC::SysV
-List::Util
 Locale::Constants
 Locale::Country
 Locale::Currency
 Locale::Language
-Locale::Maketext
-MIME::Base64
 MIME::QuotedPrint
 Math::BigFloat
-Math::BigInt
-Math::Complex
-Math::Trig
+Math::BigInt::Calc
+Memoize::AnyDBM_File
+Memoize::Expire
+Memoize::ExpireFile
+Memoize::ExpireTest
+Memoize::NDBM_File
+Memoize::SDBM_File
+Memoize::Storable
 NDBM_File
-NEXT
-Net::hostent
-Net::netent
-Net::protoent
-Net::servent
 ODBM_File
-Opcode
-PerlIO
-POSIX
 Pod::Checker
 Pod::Find
 Pod::Text
@@ -208,53 +180,20 @@ Pod::Usage
 SDBM_File
 Safe
 Scalar::Util
-Search::Dict
-SelectSaver
-SelfLoader
-Socket
-Storable
-Switch
-Symbol
-Sys::Hostname
 Sys::Syslog
-Term::ANSIColor
-Test
-Test::Harness
+Test::More
 Test::ParseWords
-Text::Abbrev
-Text::Balanced
-Text::ParseWords
-Text::Soundex
 Text::Tabs
 Text::Wrap
 Thread
 Tie::Array
 Tie::Handle
 Tie::Hash
-Tie::RefHash
 Tie::Scalar
-Tie::SubstrHash
-Time::HiRes
-Time::Local
-Time::Piece
+Time::tm
 UNIVERSAL
-User::grent
-User::pwent
-XS::Typemap
-attrs
-autouse
+attributes
 base
 bytes
-charnames
-constant
-diagnostics
-fields
-integer
-locale
 ops
-overload
-strict
-subs
-utf8
-warnings
 warnings::register