Embedding
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / 00compile.t
1 #!/usr/bin/perl -w
2
3 BEGIN {
4     if( $ENV{PERL_CORE} ) {
5         @INC = ('../lib', 'lib');
6     }
7     else {
8         unshift @INC, 't/lib';
9     }
10 }
11 chdir 't';
12
13 use File::Find;
14 use File::Spec;
15 use Test::More;
16
17 my $Has_Test_Pod;
18 BEGIN {
19     $Has_Test_Pod = eval 'use Test::Pod 0.95; 1';
20 }
21
22 my(@modules);
23
24 chdir File::Spec->catdir(File::Spec->updir, 'lib');
25 find( sub {
26         return if /~$/;
27         if( $File::Find::dir =~ /^blib|t$/ ) {
28             $File::Find::prune = 1;
29             return;
30         }
31         push @modules, $File::Find::name if /\.pm$/;
32     }, 'ExtUtils'
33 );
34
35 plan tests => scalar @modules * 2;
36 foreach my $file (@modules) {
37     local @INC = @INC;
38     unshift @INC, File::Spec->curdir;
39
40     # This piece of insanity brought to you by non-case preserving
41     # file systems!  We have extutils/command.pm, %INC has 
42     # ExtUtils/Command.pm
43     # Furthermore, 5.8.0 has a bug about require alone in an eval.  Thus
44     # the extra statement.
45     eval q{ require($file); 1 } unless grep { lc $file =~ lc $_ } keys %INC;
46     is( $@, '', "require $file" );
47
48     SKIP: {
49         skip "Test::Pod not installed", 1 unless $Has_Test_Pod;
50         pod_file_ok($file);
51     }
52     
53 }