1#!/usr/bin/perl -w
2
3BEGIN {
4    unshift @INC, 't/lib';
5}
6chdir 't';
7
8use Test::More;
9
10my $Has_Test_Pod;
11BEGIN {
12    $Has_Test_Pod = eval 'use Test::Pod 0.95; 1';
13}
14
15plan skip_all => 'No MANIFEST'
16  unless -e "../MANIFEST";
17
18chdir "..";
19
20my $manifest = "MANIFEST";
21open(my $manifest_fh, "<", $manifest) or die "Can't open $manifest: $!";
22my @modules = map  { m{^lib/(\S+)}; $1 }
23              grep { m{^lib/\S+\.pm} }
24              <$manifest_fh>;
25
26chomp @modules;
27close $manifest_fh;
28
29chdir 'lib';
30plan tests => scalar @modules * 2;
31foreach my $file (@modules) {
32    # Make sure we look at the local files and do not reload them if
33    # they're already loaded.  This avoids recompilation warnings.
34    local @INC = @INC;
35    unshift @INC, ".";
36    ok eval { require($file); 1 } or diag "require $file failed.\n$@";
37
38    SKIP: {
39        skip "Test::Pod not installed", 1 unless $Has_Test_Pod;
40        pod_file_ok($file);
41    }
42}
43