Avoid negating an unsigned value. (The offset in the SV body table)
[p5sagit/p5-mst-13.2.git] / t / lib / 1_compile.t
CommitLineData
7200bc44 1#!./perl
2
41f7d568 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
7200bc44 7BEGIN {
41f7d568 8 chdir 't';
9 @INC = '../lib';
7200bc44 10}
11
12use strict;
13use warnings;
dc459aad 14use File::Spec::Functions;
6b40b044 15
cdd2acaa 16# Okay, this is the list.
17
d36c8744 18my @Core_Modules = grep /\S/, <DATA>;
41f7d568 19chomp @Core_Modules;
7200bc44 20
7374aa61 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 }
d36c8744 27}
b3bfad09 28if(eval { require B }) {
29 push @Core_Modules, qw(B::C B::CC B::Stackobj);
30}
d36c8744 31
32@Core_Modules = sort @Core_Modules;
33
4c4ccc83 34print "1..".(1+@Core_Modules)."\n";
7200bc44 35
4c4ccc83 36my $message
37 = "ok 1 - All modules should have tests # TODO Make Schwern Poorer\n";
38if (@Core_Modules) {
39 print "not $message";
40} else {
41 print $message;
42}
983d1c14 43print <<'EOREWARD';
44# http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-04/msg01223.html
45# 20010421230349.P2946@blackrider.blackstar.co.uk
46EOREWARD
4c4ccc83 47
48my $test_num = 2;
cdd2acaa 49
7200bc44 50foreach my $module (@Core_Modules) {
b328b501 51 my $todo = '';
52 $todo = "# TODO $module needs porting on $^O" if $module eq 'ByteLoader' && $^O eq 'VMS';
53 print "# $module compile failed\nnot " unless compile_module($module);
54 print "ok $test_num $todo\n";
7200bc44 55 $test_num++;
56}
57
656b9f42 58# We do this as a separate process else we'll blow the hell
59# out of our namespace.
7200bc44 60sub compile_module {
656b9f42 61 my ($module) = $_[0];
41f7d568 62
dc459aad 63 my $compmod = catfile(curdir(), 'lib', 'compmod.pl');
64 my $lib = '-I' . catdir(updir(), 'lib');
65
66 my $out = scalar `$^X $lib $compmod $module`;
1189d1e4 67 print "# $out";
68 return $out =~ /^ok/;
7200bc44 69}
6b40b044 70
41f7d568 71# These modules have no tests of their own.
72# Keep up to date with
73# http://www.pobox.com/~schwern/cgi-bin/perl-qa-wiki.cgi?UntestedModules
74# and vice-versa. The list should only shrink.
6b40b044 75__DATA__
41f7d568 76CPAN::FirstTime
77DynaLoader
41f7d568 78Pod::Plainer