Commit | Line | Data |
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 |
7 | BEGIN { |
41f7d568 |
8 | chdir 't'; |
9 | @INC = '../lib'; |
7200bc44 |
10 | } |
11 | |
12 | use strict; |
13 | use warnings; |
dc459aad |
14 | use File::Spec::Functions; |
6b40b044 |
15 | |
cdd2acaa |
16 | # Okay, this is the list. |
17 | |
d36c8744 |
18 | my @Core_Modules = grep /\S/, <DATA>; |
41f7d568 |
19 | chomp @Core_Modules; |
7200bc44 |
20 | |
7374aa61 |
21 | if (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 | } |
28 | |
29 | @Core_Modules = sort @Core_Modules; |
30 | |
4c4ccc83 |
31 | print "1..".(1+@Core_Modules)."\n"; |
7200bc44 |
32 | |
4c4ccc83 |
33 | my $message |
34 | = "ok 1 - All modules should have tests # TODO Make Schwern Poorer\n"; |
35 | if (@Core_Modules) { |
36 | print "not $message"; |
37 | } else { |
38 | print $message; |
39 | } |
40 | |
41 | my $test_num = 2; |
cdd2acaa |
42 | |
7200bc44 |
43 | foreach my $module (@Core_Modules) { |
b328b501 |
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"; |
7200bc44 |
48 | $test_num++; |
49 | } |
50 | |
656b9f42 |
51 | # We do this as a separate process else we'll blow the hell |
52 | # out of our namespace. |
7200bc44 |
53 | sub compile_module { |
656b9f42 |
54 | my ($module) = $_[0]; |
41f7d568 |
55 | |
dc459aad |
56 | my $compmod = catfile(curdir(), 'lib', 'compmod.pl'); |
57 | my $lib = '-I' . catdir(updir(), 'lib'); |
58 | |
59 | my $out = scalar `$^X $lib $compmod $module`; |
1189d1e4 |
60 | print "# $out"; |
61 | return $out =~ /^ok/; |
7200bc44 |
62 | } |
6b40b044 |
63 | |
41f7d568 |
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. |
6b40b044 |
68 | __DATA__ |
fd0a5cd9 |
69 | B::C |
41f7d568 |
70 | B::CC |
41f7d568 |
71 | B::Stackobj |
72 | ByteLoader |
73 | CPAN |
74 | CPAN::FirstTime |
75 | DynaLoader |
76 | ExtUtils::MM_NW5 |
77 | ExtUtils::Install |
78 | ExtUtils::Liblist |
79 | ExtUtils::Mksymlists |
41f7d568 |
80 | Net::Domain |
41f7d568 |
81 | O |
82 | Pod::Plainer |
83 | Test::Harness::Iterator |