Blame t/docs/pod-spelling.t

Packit e6c7a3
#!/usr/bin/perl
Packit e6c7a3
#
Packit e6c7a3
# Check for spelling errors in POD documentation.
Packit e6c7a3
#
Packit e6c7a3
# The canonical version of this file is maintained in the rra-c-util package,
Packit e6c7a3
# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
Packit e6c7a3
#
Packit e6c7a3
# Written by Russ Allbery <eagle@eyrie.org>
Packit e6c7a3
# Copyright 2013, 2014
Packit e6c7a3
#     The Board of Trustees of the Leland Stanford Junior University
Packit e6c7a3
#
Packit e6c7a3
# Permission is hereby granted, free of charge, to any person obtaining a
Packit e6c7a3
# copy of this software and associated documentation files (the "Software"),
Packit e6c7a3
# to deal in the Software without restriction, including without limitation
Packit e6c7a3
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
Packit e6c7a3
# and/or sell copies of the Software, and to permit persons to whom the
Packit e6c7a3
# Software is furnished to do so, subject to the following conditions:
Packit e6c7a3
#
Packit e6c7a3
# The above copyright notice and this permission notice shall be included in
Packit e6c7a3
# all copies or substantial portions of the Software.
Packit e6c7a3
#
Packit e6c7a3
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Packit e6c7a3
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Packit e6c7a3
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
Packit e6c7a3
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Packit e6c7a3
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
Packit e6c7a3
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
Packit e6c7a3
# DEALINGS IN THE SOFTWARE.
Packit e6c7a3
Packit e6c7a3
use 5.006;
Packit e6c7a3
use strict;
Packit e6c7a3
use warnings;
Packit e6c7a3
Packit e6c7a3
use lib 't/lib';
Packit e6c7a3
Packit e6c7a3
use Test::More;
Packit e6c7a3
use Test::RRA qw(skip_unless_author use_prereq);
Packit e6c7a3
Packit e6c7a3
# Only run this test for the module author since the required stopwords are
Packit e6c7a3
# too sensitive to the exact spell-checking program and dictionary.
Packit e6c7a3
skip_unless_author('Spelling tests');
Packit e6c7a3
Packit e6c7a3
# Load prerequisite modules.
Packit e6c7a3
use_prereq('Test::Spelling');
Packit e6c7a3
Packit e6c7a3
# Check all POD in the Perl distribution.  Add the examples directory if it
Packit e6c7a3
# exists.  Also add any files in usr/bin or usr/sbin, which are widely used in
Packit e6c7a3
# Stanford-internal packages.
Packit e6c7a3
my @files = all_pod_files();
Packit e6c7a3
if (-d 'examples') {
Packit e6c7a3
    push(@files, all_pod_files('examples'));
Packit e6c7a3
}
Packit e6c7a3
for my $dir (qw(usr/bin usr/sbin)) {
Packit e6c7a3
    if (-d $dir) {
Packit e6c7a3
        push(@files, glob("$dir/*"));
Packit e6c7a3
    }
Packit e6c7a3
}
Packit e6c7a3
Packit e6c7a3
# We now have a list of all files to check, so output a plan and run the
Packit e6c7a3
# tests.  We can't use all_pod_files_spelling_ok because it refuses to check
Packit e6c7a3
# non-Perl files and Stanford-internal packages have a lot of shell scripts
Packit e6c7a3
# with POD documentation.
Packit e6c7a3
plan tests => scalar(@files);
Packit e6c7a3
for my $file (@files) {
Packit e6c7a3
    pod_file_spelling_ok($file);
Packit e6c7a3
}