/
pod_syntax.t
77 lines (58 loc) · 1.72 KB
/
pod_syntax.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#! perl
# Copyright (C) 2001-2010, Parrot Foundation.
use strict;
use warnings;
use Carp;
use Test::More;
use lib qw( lib );
BEGIN {
eval 'use Parrot::Test::Pod';
if ($@) {
plan skip_all => 'Prerequisites for Parrot::Test::Pod not satisfied';
exit;
}
eval 'use Parrot::Test::Pod::Utils qw(
file_pod_ok
)';
}
plan tests => 2;
my $self = Parrot::Test::Pod->new( {
argv => [ @ARGV ],
} );
ok( defined $self, "Parrot::Test::Pod returned defined value" );
my $need_testing_ref = $self->identify_files_for_POD_testing( {
second_analysis => 'oreilly_summary_malformed',
} );
my @failed_syntax;
foreach my $file ( @{ $need_testing_ref } ) {
# skip files with valid POD;
# report whatever is not skipped
unless (file_pod_ok($file)) {
push @failed_syntax, $file;
}
}
my $bad_syntax_files = join( "\n", @failed_syntax );
# only ok if everything passed
is( $bad_syntax_files, q{}, 'Pod syntax correct' );
diag("You should use podchecker to check the failed files.\n")
if $bad_syntax_files;
#################### SUBROUTINES ####################
=head1 NAME
t/codingstd/pod_syntax.t - Pod document syntax tests
=head1 SYNOPSIS
# test all files
% prove t/codingstd/pod_syntax.t
# test specific files
% perl t/codingstd/pod_syntax.t perl_module.pm perl_file.pl
=head1 DESCRIPTION
Tests the Pod syntax for all files listed in F<MANIFEST> and
F<MANIFEST.generated> that appear to contain Pod markup. If any files
contain invalid POD markup, they are reported in the test output.
Use C<podchecker> to ferret out individual issues.
=cut
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4: