[svn:parrot] r36578 - branches/update_pod/t/doc

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Wed Feb 11 12:11:32 UTC 2009


Author: jkeenan
Date: Wed Feb 11 12:11:32 2009
New Revision: 36578
URL: https://trac.parrot.org/parrot/changeset/36578

Log:
In the middle of modifications.  Not stable.

Modified:
   branches/update_pod/t/doc/pod.t

Modified: branches/update_pod/t/doc/pod.t
==============================================================================
--- branches/update_pod/t/doc/pod.t	Wed Feb 11 11:44:07 2009	(r36577)
+++ branches/update_pod/t/doc/pod.t	Wed Feb 11 12:11:32 2009	(r36578)
@@ -5,12 +5,12 @@
 use strict;
 use warnings;
 
-use lib qw( . lib ../lib ../../lib );
-
 use Carp;
 use Test::More;
-use Parrot::Config;
+use Storable qw(nstore retrieve);
 use ExtUtils::Manifest qw(maniread);
+use lib qw( lib );
+use Parrot::Config;
 
 our (@failed_syntax, @empty_description);
 
@@ -89,7 +89,7 @@
 
 sub identify_files_for_POD_testing {
     my $args = shift;
-    my ( @files, %files_needing_analysis );
+    my ( @files, $files_needing_analysis );
 
     if ( scalar(@{ $args->{argv} }) ) {
         @files = @{ $args->{argv} };
@@ -101,38 +101,52 @@
             keys(%{ $args->{manifest_gen} })
         );
     }
-    $files_needing_analysis{$_}++ for @files;
-#    foreach my $k (keys %files_needing_analysis) {
-#        print STDERR "$k\t$files_needing_analysis{$k}\n"
-#        if $files_needing_analysis{$k} > 1;
-#    }
+    $files_needing_analysis->{$_}++ for @files;
+    # https://trac.parrot.org/parrot/ticket/311
+    # Certain files will be found in both MANIFEST.generated (because they're
+    # generated by bison or flex) and MANIFEST (we have them in repository so 
+    # that normal users don't have to generate them).
+    # foreach my $k (keys %$files_needing_analysis) {
+    #   print STDERR "$k\t$files_needing_analysis->{$k}\n"
+    #   if $files_needing_analysis->{$k} > 1;
+    # }
     
-    FILE: foreach my $file ( keys %files_needing_analysis ) {
-        my $full_file = qq|$args->{build_dir}/$file|;
-    
-        # skip missing MANIFEST.generated files ( -e )
-        # skip binary files (including .pbc files) ( -B )
-        # skip files that pass the -e test because they resolve the .exe variant
-        unless (-T $full_file) {
-            delete $files_needing_analysis{ $file };
-            next FILE;
+    # Make not hard-coded.
+    my $sto = q{.pod_examinable.sto};
+    if ( (! -e $sto ) or (! _verify_eval( $files_needing_analysis, $sto ) ) ) {
+        # do FIRST_FILE
+        FIRST_FILE: foreach my $file ( keys %{ $files_needing_analysis } ) {
+            my $full_file = qq|$args->{build_dir}/$file|;
+        
+            # skip missing MANIFEST.generated files ( -e )
+            # skip binary files (including .pbc files) ( -B )
+            # skip files that pass the -e test because they resolve the .exe variant
+            unless (-T $full_file) {
+                delete $files_needing_analysis->{ $file };
+                next FIRST_FILE;
+            }
+        
+            # skip files without POD
+            unless (Pod::Find::contains_pod( $full_file, 0 )) {
+                delete $files_needing_analysis->{ $file };
+                next FIRST_FILE;
+            }
         }
+    }
+
+    SECOND_FILE: foreach my $file ( keys %{ $files_needing_analysis } ) {
+        my $full_file = qq|$args->{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 FILE;
-        }
-        # skip files without POD
-        unless (Pod::Find::contains_pod( $full_file, 0 )) {
-            delete $files_needing_analysis{ $file };
-            next FILE;
+            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 FILE;
+            delete $files_needing_analysis->{ $file };
+            next SECOND_FILE;
         }
     
         # skip file which includes malformed POD for other testing purposes
@@ -142,11 +156,17 @@
                 languages/pod/test\.pod
             }x
         ) {
-            delete $files_needing_analysis{ $file };
-            next FILE;
+            delete $files_needing_analysis->{ $file };
+            next SECOND_FILE;
         }
     }
-    return [ keys %files_needing_analysis ];
+    return [ keys %{ $files_needing_analysis } ];
+}
+
+sub _verify_eval {
+    my ($files_needing_analysis, $sto) = @_;
+    eval { $files_needing_analysis = retrieve($sto) };
+    $@ ? 0 : 1;
 }
 
 # Pulled from Test::Pod


More information about the parrot-commits mailing list