[svn:parrot] r37780 - trunk/t/codingstd

coke at svn.parrot.org coke at svn.parrot.org
Sat Mar 28 00:43:28 UTC 2009


Author: coke
Date: Sat Mar 28 00:43:26 2009
New Revision: 37780
URL: https://trac.parrot.org/parrot/changeset/37780

Log:
[t] function docs shouldn't need function attributes like PARROT_FOO;
Empty documentation slots don't count as docs.
Always list all functions (eliminate old style for multi-file)

fix copyright, remove author section.
This test hasn't kept up with the headerizer, which it depends on.

Modified:
   trunk/t/codingstd/c_function_docs.t

Modified: trunk/t/codingstd/c_function_docs.t
==============================================================================
--- trunk/t/codingstd/c_function_docs.t	Fri Mar 27 23:53:40 2009	(r37779)
+++ trunk/t/codingstd/c_function_docs.t	Sat Mar 28 00:43:26 2009	(r37780)
@@ -1,5 +1,5 @@
 #! perl
-# Copyright (C) 2006, Parrot Foundation.
+# Copyright (C) 2006-2009, Parrot Foundation.
 # $Id$
 
 use strict;
@@ -27,10 +27,6 @@
 Checks that all C language source files have documentation for each function
 declared.
 
-=head1 AUTHOR
-
-Paul Cochrane <paultcochrane at gmail dot com>
-
 =cut
 
 my $DIST = Parrot::Distribution->new;
@@ -50,6 +46,9 @@
 
         my $escaped_decl = $function_decl;
 
+        # strip out any PARROT_* prefixes...
+        $escaped_decl =~ s/^PARROT_[A-Z_]*\b\s*//g;        
+
         # escape [, ], (, ), and *
         $escaped_decl =~ s/\[/\\[/g;
         $escaped_decl =~ s/\]/\\]/g;
@@ -57,44 +56,39 @@
         $escaped_decl =~ s/\)/\\)/g;
         $escaped_decl =~ s/\*/\\*/g;
 
+
+
         # don't worry if the function declaration has embedded newlines in
         # it and the documented function doesn't.
         $escaped_decl =~ s/\s+/\\s+/g;
 
-        my $decl_rx = qr/=item C<$escaped_decl>/;
+        my $decl_rx_content = qr/^=item C<$escaped_decl>(.*?)^=cut/sm;
+        my $decl_rx_ws_only = qr/^=item C<$escaped_decl>\s+^=cut/sm;
 
-        # if we're sent just a single file, output all function declarations
-        # which aren't yet documented, otherwise just report the files
-        # without docs.
-        if ( $buf !~ m/$decl_rx/g ) {
-            if ( @ARGV == 1 ) {
-                push @missing_docs, "$function_decl\n";
-            }
-            else {
-                push @missing_docs, "$path\n";
-                last;
-            }
+        my $missing = '';
+        if ( $buf =~ m/$decl_rx_content/ ) {
+            # yay, docs!
+        }
+        elsif ($buf =~ $decl_rx_ws_only) {
+            $missing = 'boilerplate only';
+        }
+        else {
+            $missing = 'missing'; 
+        }
+        if ($missing) {
+            push @missing_docs, "$path: $function_decl ($missing)\n";
         }
     }
 }
 
 TODO: {
     local $TODO = 'not all functions are documented yet.';
-if ( @ARGV == 1 ) {
+
     ok( !scalar(@missing_docs), 'Functions documented' )
-        or diag( "Number of functions lacking documentation = "
-            . scalar @missing_docs
-            . "\n Functions lacking documentation:\n"
+        or diag( scalar @missing_docs
+            . " functions lacking documentation = "
             . join "#" x 70 . "\n", @missing_docs, "\n");
 }
-else {
-    ok( !scalar(@missing_docs), 'Functions documented' )
-        or diag( "Functions lacking documentation in "
-            . scalar @missing_docs
-            . " files:\n at missing_docs\n"
-            . "Use tools/docs/func_boilerplate.pl to add missing documentation\n" );
-}
-}
 
 # Local Variables:
 #   mode: cperl


More information about the parrot-commits mailing list