This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Create subdirectory t/opbasic. Move 5 test files there.
[perl5.git] / t / lib / 1_compile.t
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
7 BEGIN {
8     chdir 't';
9     @INC = '../lib';
10     require './test.pl';
11 }
12
13 use warnings;
14 use File::Spec::Functions;
15
16 # Okay, this is the list.
17
18 my @Core_Modules = grep /\S/, <DATA>;
19 chomp @Core_Modules;
20
21 if (eval { require Socket }) {
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   }
26 }
27
28 @Core_Modules = sort @Core_Modules;
29
30 plan tests => 1+@Core_Modules;
31
32 cmp_ok(@Core_Modules, '>', 0, "All modules should have tests");
33 note("http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-04/msg01223.html");
34 note("20010421230349.P2946\@blackrider.blackstar.co.uk");
35
36 foreach my $module (@Core_Modules) {
37     if ($module eq 'ByteLoader' && $^O eq 'VMS') {
38         TODO: {
39             local $TODO = "$module needs porting on $^O";
40             ok(compile_module($module), "compile $module");
41         }
42     }
43     else {
44         ok(compile_module($module), "compile $module");
45     }
46 }
47
48 # We do this as a separate process else we'll blow the hell
49 # out of our namespace.
50 sub compile_module {
51     my ($module) = $_[0];
52
53     my $compmod = catfile(curdir(), 'lib', 'compmod.pl');
54     my $lib     = '-I' . catdir(updir(), 'lib');
55
56     my $out = scalar `$^X $lib $compmod $module`;
57     return $out =~ /^ok/;
58 }
59
60 # These modules have no tests of their own.
61 # Keep up to date with
62 # http://perl-qa.hexten.net/wiki/index.php/Untested_Core_Modules
63 # and vice-versa.  The list should only shrink.
64 __DATA__