[svn:parrot] r45015 - trunk/t/codingstd
Util at svn.parrot.org
Util at svn.parrot.org
Thu Mar 18 16:43:19 UTC 2010
Author: Util
Date: Thu Mar 18 16:43:18 2010
New Revision: 45015
URL: https://trac.parrot.org/parrot/changeset/45015
Log:
[t] pdd_format.t - Changed to check the mandatory sections more thoroughly.
Existing code failed to find extra chars at the end of the section name.
For example: when "Abstract" is required, "Abstracts" should not fulfill
the requirement, but the old code passed. The new code correctly fails.
Modified:
trunk/t/codingstd/pdd_format.t
Modified: trunk/t/codingstd/pdd_format.t
==============================================================================
--- trunk/t/codingstd/pdd_format.t Thu Mar 18 16:23:14 2010 (r45014)
+++ trunk/t/codingstd/pdd_format.t Thu Mar 18 16:43:18 2010 (r45015)
@@ -57,7 +57,7 @@
Implementation
References
);
- my %sections_seen = map { $_, 0 } @sections_needed;
+ my %sections_seen;
my @lines;
tie @lines, 'Tie::File', $pdd
or croak "Unable to tie to $pdd: $!";
@@ -69,8 +69,8 @@
) {
push @toolong, ($i + 1);
}
- foreach my $need ( @sections_needed ) {
- $sections_seen{$need}++ if $lines[$i] =~ m{^=head2\s+$need};
+ if ( $lines[$i] =~ m{^=head2\s+(.+?)\s*$} ) {
+ $sections_seen{$1}++;
}
}
untie @lines or croak "Unable to untie from $pdd: $!";
@@ -80,7 +80,7 @@
scalar(@toolong) .
qq{ lines > 78 chars: @toolong\n};
}
- foreach my $need ( keys %sections_seen ) {
+ foreach my $need (@sections_needed) {
if ( ! $sections_seen{$need} ) {
$diag .= qq{$base lacks 'head2' $need section\n};
}
More information about the parrot-commits
mailing list