1#!./perl 2 3# Modules should have their own tests. For historical reasons, some 4# do not. This does basic compile tests on modules that have no tests 5# of their own. 6 7BEGIN { 8 chdir 't'; 9 @INC = '../lib'; 10} 11 12use strict; 13use warnings; 14use File::Spec::Functions; 15 16# Okay, this is the list. 17 18my @Core_Modules = grep /\S/, <DATA>; 19chomp @Core_Modules; 20 21if (eval { require Socket }) { 22 push @Core_Modules, qw(Net::Domain); 23 # Two Net:: modules need the Convert::EBCDIC if in EBDCIC. 24 if (ord("A") != 193 || eval { require Convert::EBCDIC }) { 25 push @Core_Modules, qw(Net::Cmd Net::POP3); 26 } 27} 28 29@Core_Modules = sort @Core_Modules; 30 31print "1..".(1+@Core_Modules)."\n"; 32 33my $message 34 = "ok 1 - All modules should have tests # TODO Make Schwern Poorer\n"; 35if (@Core_Modules) { 36 print "not $message"; 37} else { 38 print $message; 39} 40 41my $test_num = 2; 42 43foreach my $module (@Core_Modules) { 44 my $todo = ''; 45 $todo = "# TODO $module needs porting on $^O" if $module eq 'ByteLoader' && $^O eq 'VMS'; 46 print "# $module compile failed\nnot " unless compile_module($module); 47 print "ok $test_num $todo\n"; 48 $test_num++; 49} 50 51# We do this as a separate process else we'll blow the hell 52# out of our namespace. 53sub compile_module { 54 my ($module) = $_[0]; 55 56 my $compmod = catfile(curdir(), 'lib', 'compmod.pl'); 57 my $lib = '-I' . catdir(updir(), 'lib'); 58 59 my $out = scalar `$^X $lib $compmod $module`; 60 print "# $out"; 61 return $out =~ /^ok/; 62} 63 64# These modules have no tests of their own. 65# Keep up to date with 66# http://www.pobox.com/~schwern/cgi-bin/perl-qa-wiki.cgi?UntestedModules 67# and vice-versa. The list should only shrink. 68__DATA__ 69B::C 70B::CC 71B::Stackobj 72ByteLoader 73CPAN::FirstTime 74DynaLoader 75Pod::Plainer 76