xref: /openbsd-src/gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/t/00compile.t (revision 256a93a44f36679bee503f12e49566c2183f6181)
1b39c5158Smillert#!/usr/bin/perl -w
2b39c5158Smillert
3b39c5158SmillertBEGIN {
4b39c5158Smillert    unshift @INC, 't/lib';
5b39c5158Smillert}
6b39c5158Smillertchdir 't';
7b39c5158Smillert
8*256a93a4Safresh1use warnings;
9b39c5158Smillertuse Test::More;
10b39c5158Smillert
11b39c5158Smillertmy $Has_Test_Pod;
12b39c5158SmillertBEGIN {
13b39c5158Smillert    $Has_Test_Pod = eval 'use Test::Pod 0.95; 1';
14b39c5158Smillert}
15b39c5158Smillert
16898184e3Ssthenplan skip_all => 'No MANIFEST'
17898184e3Ssthen  unless -e "../MANIFEST";
18898184e3Ssthen
19b39c5158Smillertchdir "..";
20898184e3Ssthen
21b39c5158Smillertmy $manifest = "MANIFEST";
22b39c5158Smillertopen(my $manifest_fh, "<", $manifest) or die "Can't open $manifest: $!";
23b39c5158Smillertmy @modules = map  { m{^lib/(\S+)}; $1 }
24b39c5158Smillert              grep { m{^lib/\S+\.pm} }
25b39c5158Smillert              <$manifest_fh>;
26b39c5158Smillert
27b39c5158Smillertchomp @modules;
28b39c5158Smillertclose $manifest_fh;
29b39c5158Smillert
30b39c5158Smillertchdir 'lib';
31b39c5158Smillertplan tests => scalar @modules * 2;
32b39c5158Smillertforeach my $file (@modules) {
33b39c5158Smillert    # Make sure we look at the local files and do not reload them if
34b39c5158Smillert    # they're already loaded.  This avoids recompilation warnings.
35b39c5158Smillert    local @INC = @INC;
36b39c5158Smillert    unshift @INC, ".";
37b39c5158Smillert    ok eval { require($file); 1 } or diag "require $file failed.\n$@";
38b39c5158Smillert
39b39c5158Smillert    SKIP: {
40b39c5158Smillert        skip "Test::Pod not installed", 1 unless $Has_Test_Pod;
41b39c5158Smillert        pod_file_ok($file);
42b39c5158Smillert    }
43b39c5158Smillert}
44