[svn:parrot] r36711 - in branches/update_pod: lib/Parrot/Test/Pod t/codingstd

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Sat Feb 14 03:11:55 UTC 2009


Author: jkeenan
Date: Sat Feb 14 03:11:54 2009
New Revision: 36711
URL: https://trac.parrot.org/parrot/changeset/36711

Log:
Extract oreilly_summary_malformed() from t/codingstd/pod.t and place it in Parrot::Test::Pod::Util.

Modified:
   branches/update_pod/lib/Parrot/Test/Pod/Util.pm
   branches/update_pod/t/codingstd/pod.t

Modified: branches/update_pod/lib/Parrot/Test/Pod/Util.pm
==============================================================================
--- branches/update_pod/lib/Parrot/Test/Pod/Util.pm	Sat Feb 14 02:24:19 2009	(r36710)
+++ branches/update_pod/lib/Parrot/Test/Pod/Util.pm	Sat Feb 14 03:11:54 2009	(r36711)
@@ -10,6 +10,7 @@
 our @ISA = qw( Exporter );
 our @EXPORT_OK = qw(
     identify_files_for_POD_testing
+    oreilly_summary_malformed
 );
 
 =head1 Parrot::Test::Pod::Util
@@ -35,8 +36,8 @@
 
 B<Purpose:>
 
-Identifies files in the Parrot distribution
-which are likely to merit examination for the validity of their POD.
+Identifies files in the Parrot distribution which are likely to merit
+examination for the validity of their POD.
 
 The subroutine itself does a first pass at that process, and takes as one of
 its arguments a reference to a subroutine which does a second such pass.
@@ -48,7 +49,7 @@
         manifest        => $manifest,
         manifest_gen    => $manifest_gen,
         build_dir       => $build_dir,
-        second_analysis => \&second_analysis,
+        second_analysis => \&oreilly_summary_malformed,
     } );
 
 B<Return Value:>
@@ -139,6 +140,98 @@
     return [ keys %{ $files_needing_analysis } ];
 }
 
+=head3 C<oreilly_summary_malformed()>
+
+B<Purpose:>
+
+An instance of the "second pass" type of subroutine passed to
+C<identify_files_for_POD_testing()> C<second_analysis> argument.
+
+In this instance, we omit:
+
+=over 4
+
+=item *
+
+files in F<docs/book/> that use
+extended O'Reilly-specific POD;
+
+=item *
+
+programs that generate POD; and
+
+=item *
+
+files which for other testing purposes have deliberately malformed POD.
+
+=back
+
+B<Arguments:> Two scalar arguments:
+
+=over 4
+
+=item *
+
+Reference to hash of files meriting analysis, generated in first part of 
+C<identify_files_for_POD_testing()>.
+
+=item *
+
+Path to build directory (currently, the top-level Parrot directory).
+
+=back
+
+B<Return Value:>
+
+Reference to hash of files meriting analysis, I<i.e.,> the results of the
+first pass minus the results of the second pass.
+
+=cut
+
+sub oreilly_summary_malformed {
+    my ($files_needing_analysis, $build_dir) = @_;
+    my $sto = q{.pod_examinable_oreilly_summary_malformed.sto};
+    if ( -e $sto ) {
+        eval { $files_needing_analysis = retrieve($sto) };
+        if ($@) {
+            croak "$sto exists on disk but could not retrieve from it";
+        }
+        else {
+            return $files_needing_analysis;
+        }
+    }
+    else {
+        SECOND_FILE: foreach my $file ( keys %{ $files_needing_analysis } ) {
+            my $full_file = qq|$build_dir/$file|;
+        
+            # Skip the book, because it uses extended O'Reilly-specific POD
+            if ($full_file =~ m{docs/book/}) {
+                delete $files_needing_analysis->{ $file };
+                next SECOND_FILE;
+            }
+        
+            # skip POD generating scripts
+            if ($full_file =~ m/ops_summary\.pl/) {
+                delete $files_needing_analysis->{ $file };
+                next SECOND_FILE;
+            }
+        
+            # skip file which includes malformed POD for other testing purposes
+            if ($full_file =~ m{
+                    t/tools/dev/searchops/samples\.pm
+                    |
+                    languages/pod/test\.pod
+                }x
+            ) {
+                delete $files_needing_analysis->{ $file };
+                next SECOND_FILE;
+            }
+        }
+    }
+    nstore $files_needing_analysis, $sto;
+    return $files_needing_analysis;
+}
+
 =head2 Author
 
 James E Keenan, refactored from earlier code

Modified: branches/update_pod/t/codingstd/pod.t
==============================================================================
--- branches/update_pod/t/codingstd/pod.t	Sat Feb 14 02:24:19 2009	(r36710)
+++ branches/update_pod/t/codingstd/pod.t	Sat Feb 14 03:11:54 2009	(r36711)
@@ -8,11 +8,11 @@
 use Carp;
 use Test::More;
 use ExtUtils::Manifest qw(maniread);
-use Storable qw(nstore retrieve);
 use lib qw( lib );
 use Parrot::Config;
 use Parrot::Test::Pod::Util qw(
     identify_files_for_POD_testing
+    oreilly_summary_malformed
 );
 
 BEGIN {
@@ -86,50 +86,6 @@
 
 #################### SUBROUTINES ####################
 
-sub oreilly_summary_malformed {
-    my ($files_needing_analysis, $build_dir) = @_;
-    my $sto = q{.pod_examinable_oreilly_summary_malformed.sto};
-    if ( -e $sto ) {
-        eval { $files_needing_analysis = retrieve($sto) };
-        if ($@) {
-            croak "$sto exists on disk but could not retrieve from it";
-        }
-        else {
-            return $files_needing_analysis;
-        }
-    }
-    else {
-        SECOND_FILE: foreach my $file ( keys %{ $files_needing_analysis } ) {
-            my $full_file = qq|$build_dir/$file|;
-        
-            # Skip the book, because it uses extended O'Reilly-specific POD
-            if ($full_file =~ m{docs/book/}) {
-                delete $files_needing_analysis->{ $file };
-                next SECOND_FILE;
-            }
-        
-            # skip POD generating scripts
-            if ($full_file =~ m/ops_summary\.pl/) {
-                delete $files_needing_analysis->{ $file };
-                next SECOND_FILE;
-            }
-        
-            # skip file which includes malformed POD for other testing purposes
-            if ($full_file =~ m{
-                    t/tools/dev/searchops/samples\.pm
-                    |
-                    languages/pod/test\.pod
-                }x
-            ) {
-                delete $files_needing_analysis->{ $file };
-                next SECOND_FILE;
-            }
-        }
-    }
-    nstore $files_needing_analysis, $sto;
-    return $files_needing_analysis;
-}
-
 # Pulled from Test::Pod
 sub file_pod_ok {
     my $file    = shift;
@@ -156,7 +112,6 @@
     return 0;
 }
 
-
 =head1 NAME
 
 t/codingstd/pod.t - Pod document syntax tests


More information about the parrot-commits mailing list