2 # Copyright (C) 2001-2009, Parrot Foundation.
8 use Test::More tests => 1;
18 foreach my $dir (@pdddirs) {
19 die "Directory '$dir' is not found, or not a directory" if not -d $dir;
21 my @pdds = glob "$dir/pdd*.pod"
22 or warn "No PDD files found in directory '$dir'";
24 push @pddfiles, @pdds;
28 foreach my $pdd (@pddfiles) {
29 my $diag = check_pdd_formatting($pdd);
31 push @diagnostics, $diag;
35 for my $msg (@diagnostics) {
38 cmp_ok( scalar(@diagnostics), '==', 0, 'PDDs are formatted correctly' );
40 sub check_pdd_formatting {
45 my @sections_needed = qw(
54 tie @lines, 'Tie::File', $pdd
55 or croak "Unable to tie to $pdd: $!";
56 for (my $i=0; $i<=$#lines; $i++) {
58 ( length( $lines[$i] ) > 78 )
60 ( $lines[$i] !~ m/^(?:F|L)<|<http|\$Id:\s+/ )
62 push @toolong, ($i + 1);
64 if ( $lines[$i] =~ m{^=head2\s+(.+?)\s*$} ) {
68 untie @lines or croak "Unable to untie from $pdd: $!";
73 qq{ lines > 78 chars: @toolong\n};
75 foreach my $need (@sections_needed) {
76 if ( ! $sections_seen{$need} ) {
77 $diag .= qq{$pdd lacks 'head2' $need section\n};
85 # cperl-indent-level: 4
88 # vim: expandtab shiftwidth=4: