summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/t/lib/1_compile.t
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-10-27 22:15:15 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-10-27 22:15:15 +0000
commit74cfb115ac810480c0000dc742b20383c1578bac (patch)
tree316d96e5123617976f1637b143570c309a662045 /gnu/usr.bin/perl/t/lib/1_compile.t
parent453ade492b8e06c619009d6cd52a85cb04e8cf17 (diff)
stock perl 5.8.0 from CPAN
Diffstat (limited to 'gnu/usr.bin/perl/t/lib/1_compile.t')
-rw-r--r--gnu/usr.bin/perl/t/lib/1_compile.t81
1 files changed, 81 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/t/lib/1_compile.t b/gnu/usr.bin/perl/t/lib/1_compile.t
new file mode 100644
index 00000000000..45631dd5b8d
--- /dev/null
+++ b/gnu/usr.bin/perl/t/lib/1_compile.t
@@ -0,0 +1,81 @@
+#!./perl
+
+# Modules should have their own tests. For historical reasons, some
+# do not. This does basic compile tests on modules that have no tests
+# of their own.
+
+BEGIN {
+ chdir 't';
+ @INC = '../lib';
+}
+
+use strict;
+use warnings;
+use File::Spec::Functions;
+
+# Okay, this is the list.
+
+my @Core_Modules = grep /\S/, <DATA>;
+chomp @Core_Modules;
+
+if (eval { require Socket }) {
+ push @Core_Modules, qw(Net::Domain);
+ # Two Net:: modules need the Convert::EBCDIC if in EBDCIC.
+ if (ord("A") != 193 || eval { require Convert::EBCDIC }) {
+ push @Core_Modules, qw(Net::Cmd Net::POP3);
+ }
+}
+
+@Core_Modules = sort @Core_Modules;
+
+print "1..".(1+@Core_Modules)."\n";
+
+my $message
+ = "ok 1 - All modules should have tests # TODO Make Schwern Poorer\n";
+if (@Core_Modules) {
+ print "not $message";
+} else {
+ print $message;
+}
+
+my $test_num = 2;
+
+foreach my $module (@Core_Modules) {
+ my $todo = '';
+ $todo = "# TODO $module needs porting on $^O" if $module eq 'ByteLoader' && $^O eq 'VMS';
+ print "# $module compile failed\nnot " unless compile_module($module);
+ print "ok $test_num $todo\n";
+ $test_num++;
+}
+
+# We do this as a separate process else we'll blow the hell
+# out of our namespace.
+sub compile_module {
+ my ($module) = $_[0];
+
+ my $compmod = catfile(curdir(), 'lib', 'compmod.pl');
+ my $lib = '-I' . catdir(updir(), 'lib');
+
+ my $out = scalar `$^X $lib $compmod $module`;
+ print "# $out";
+ return $out =~ /^ok/;
+}
+
+# These modules have no tests of their own.
+# Keep up to date with
+# http://www.pobox.com/~schwern/cgi-bin/perl-qa-wiki.cgi?UntestedModules
+# and vice-versa. The list should only shrink.
+__DATA__
+B::C
+B::CC
+B::Stackobj
+ByteLoader
+CPAN
+CPAN::FirstTime
+DynaLoader
+ExtUtils::MM_NW5
+ExtUtils::Install
+ExtUtils::Liblist
+ExtUtils::Mksymlists
+Pod::Plainer
+Test::Harness::Iterator