This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make $class->method work when $class is tied
[perl5.git] / t / lib / 1_compile.t
CommitLineData
7200bc44
JH
1#!./perl
2
41f7d568
MS
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
MS
8 chdir 't';
9 @INC = '../lib';
7200bc44
JH
10}
11
12use strict;
13use warnings;
dc459aad 14use File::Spec::Functions;
6b40b044 15
cdd2acaa
JH
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 }) {
7374aa61
JH
22 # Two Net:: modules need the Convert::EBCDIC if in EBDCIC.
23 if (ord("A") != 193 || eval { require Convert::EBCDIC }) {
24 push @Core_Modules, qw(Net::Cmd Net::POP3);
25 }
d36c8744
JH
26}
27
28@Core_Modules = sort @Core_Modules;
29
4c4ccc83 30print "1..".(1+@Core_Modules)."\n";
7200bc44 31
4c4ccc83
NC
32my $message
33 = "ok 1 - All modules should have tests # TODO Make Schwern Poorer\n";
34if (@Core_Modules) {
35 print "not $message";
36} else {
37 print $message;
38}
983d1c14
NC
39print <<'EOREWARD';
40# http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-04/msg01223.html
41# 20010421230349.P2946@blackrider.blackstar.co.uk
42EOREWARD
4c4ccc83
NC
43
44my $test_num = 2;
cdd2acaa 45
7200bc44 46foreach my $module (@Core_Modules) {
b328b501
CB
47 my $todo = '';
48 $todo = "# TODO $module needs porting on $^O" if $module eq 'ByteLoader' && $^O eq 'VMS';
49 print "# $module compile failed\nnot " unless compile_module($module);
50 print "ok $test_num $todo\n";
7200bc44
JH
51 $test_num++;
52}
53
656b9f42
JH
54# We do this as a separate process else we'll blow the hell
55# out of our namespace.
7200bc44 56sub compile_module {
656b9f42 57 my ($module) = $_[0];
41f7d568 58
dc459aad
JH
59 my $compmod = catfile(curdir(), 'lib', 'compmod.pl');
60 my $lib = '-I' . catdir(updir(), 'lib');
61
62 my $out = scalar `$^X $lib $compmod $module`;
1189d1e4
JH
63 print "# $out";
64 return $out =~ /^ok/;
7200bc44 65}
6b40b044 66
41f7d568
MS
67# These modules have no tests of their own.
68# Keep up to date with
99e209c8 69# http://perl-qa.hexten.net/wiki/index.php/Untested_Core_Modules
41f7d568 70# and vice-versa. The list should only shrink.
6b40b044 71__DATA__