3 # t/pod-spelling.t -- Test POD spelling.
5 # Called to skip all tests with a reason.
8 print "ok 1 # skip - @_\n";
12 # Make sure we have prerequisites. hunspell is currently not supported due to
13 # lack of support for contractions.
14 eval 'use Test::Pod 1.00';
15 skip_all "Test::Pod 1.00 required for testing POD" if $@;
16 eval 'use Pod::Spell';
17 skip_all "Pod::Spell required to test POD spelling" if $@;
19 my %options = (aspell => [ qw(-d en_US --home-dir=./ list) ],
20 ispell => [ qw(-d american -l -p /dev/null) ]);
21 SEARCH: for my $program (qw/aspell ispell/) {
22 for my $dir (split ':', $ENV{PATH}) {
23 if (-x "$dir/$program") {
24 @spell = ("$dir/$program", @{ $options{$program} });
26 last SEARCH if @spell;
29 skip_all "aspell or ispell required to test POD spelling" unless @spell;
31 # Run the test, one for each POD file.
33 my @pod = all_pod_files ();
34 my $count = scalar @pod;
38 my $child = open (CHILD, '-|');
39 if (not defined $child) {
40 die "Cannot fork: $!\n";
41 } elsif ($child == 0) {
42 my $pid = open (SPELL, '|-', @spell)
43 or die "Cannot run @spell: $!\n";
44 open (POD, '<', $pod) or die "Cannot open $pod: $!\n";
45 my $parser = Pod::Spell->new;
46 $parser->parse_from_filehandle (\*POD, \*SPELL);
54 print "ok $n # skip - @spell failed: $?\n";
61 print " - Misspelled words found in $pod\n";