[svn:parrot] r36702 - in branches/update_pod: . t/codingstd t/doc

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Sat Feb 14 00:01:27 UTC 2009


Author: jkeenan
Date: Sat Feb 14 00:01:25 2009
New Revision: 36702
URL: https://trac.parrot.org/parrot/changeset/36702

Log:
Move opcode-doc.t to t/codingstd/.

Added:
   branches/update_pod/t/codingstd/opcode-doc.t
      - copied unchanged from r36699, branches/update_pod/t/doc/opcode-doc.t
   branches/update_pod/t/codingstd/pod.t
      - copied, changed from r36700, branches/update_pod/t/doc/pod.t
Deleted:
   branches/update_pod/t/doc/opcode-doc.t
   branches/update_pod/t/doc/pod.t
Modified:
   branches/update_pod/MANIFEST

Modified: branches/update_pod/MANIFEST
==============================================================================
--- branches/update_pod/MANIFEST	Fri Feb 13 23:59:48 2009	(r36701)
+++ branches/update_pod/MANIFEST	Sat Feb 14 00:01:25 2009	(r36702)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Fri Feb 13 02:35:14 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Feb 14 00:00:37 2009 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -2821,6 +2821,7 @@
 t/codingstd/pdd_format.t                                    []
 t/codingstd/perlcritic.t                                    []
 t/codingstd/pir_code_coda.t                                 []
+t/codingstd/pod.t                                           []
 t/codingstd/pod_todo.t                                      []
 t/codingstd/svn_id.t                                        []
 t/codingstd/tabs.t                                          []
@@ -2964,7 +2965,6 @@
 t/distro/meta_yml.t                                         []
 t/distro/test_file_coverage.t                               []
 t/doc/opcode-doc.t                                          []
-t/doc/pod.t                                                 []
 t/dynoplibs/dan.t                                           []
 t/dynoplibs/myops.t                                         []
 t/dynpmc/digest.t                                           []

Copied: branches/update_pod/t/codingstd/opcode-doc.t (from r36699, branches/update_pod/t/doc/opcode-doc.t)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/update_pod/t/codingstd/opcode-doc.t	Sat Feb 14 00:01:25 2009	(r36702, copy of r36699, branches/update_pod/t/doc/opcode-doc.t)
@@ -0,0 +1,97 @@
+#! perl
+# Copyright (C) 2001-2005, The Perl Foundation.
+# $Id$
+
+use strict;
+use warnings;
+use lib qw( . lib ../lib ../../lib );
+use Test::More tests => 1;
+
+=head1 NAME
+
+t/perl/opcode-doc.t - check opcode documentation
+
+=head1 SYNOPSIS
+
+    % prove t/perl/opcode-doc.t
+
+=head1 DESCRIPTION
+
+Checks whether all opcodes are documented.
+
+=cut
+
+my @docerr;
+
+sub slurp {
+    my ($filename) = @_;
+
+    open my $FILE, '<', "$filename" or die "can't open '$filename' for reading";
+    my @file = <$FILE>;
+    close $FILE;
+    return @file;
+}
+
+sub analyse {
+    my ( $filename, $ops ) = @_;
+
+    my %file;
+
+    foreach my $op ( keys %$ops ) {
+        my $args = $ops->{$op};
+        next if $op =~ /^DELETED/;
+        next if $op =~ /^isgt/;      # doced but rewritten
+        next if $op =~ /^isge/;
+        foreach my $arg ( keys %$args ) {
+            my $e   = $args->{$arg};
+            my $val = $e->{status};
+            next if $val == 3;       # doc & impl
+            $file{ $e->{def} } = "no documentation for $op($arg)" if exists $e->{def};
+            $file{ $e->{doc} } = "no definition of $op($arg)"     if exists $e->{doc};
+        }
+    }
+
+    foreach my $line ( sort { $a <=> $b } keys %file ) {
+        push @docerr, "$filename:$line: $file{$line}\n";
+    }
+}
+
+sub check_op_doc {
+    my ($filename) = @_;
+
+    my @file = slurp($filename);
+    my %op;
+    my $lineno = 0;
+
+    foreach my $line (@file) {
+        ++$lineno;
+        if ( my ($item) = $line =~ /^=item\s+(.+\(.*)/ ) {
+            if ( $item =~ /^([BC])\<(.*)\>\s*\((.*?)\)/ ) {
+                print "$filename:$lineno: use B<...> instead of C<...>\n"
+                    if $1 eq "C";
+                my ( $op, $args ) = ( $2, $3 );
+                $args =~ s!\s*/\*.*?\*/!!;    # del C comment in args
+                $op{$op}{$args}{doc} = $lineno;
+                $op{$op}{$args}{status} |= 1;
+            }
+        }
+        elsif ( $line =~ /^(inline )?\s*op\s*(\S+)\s*\((.*?)\)/ ) {
+            $op{$2}{$3}{def} = $lineno;
+            $op{$2}{$3}{status} |= 2;
+        }
+    }
+    analyse( $filename, \%op );
+}
+
+foreach my $file (<ops/*.ops>) {
+    check_op_doc $file;
+}
+
+ok( !@docerr, 'opcode documentation' ) or diag("Opcode documentation errors:\n at docerr");
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Copied and modified: branches/update_pod/t/codingstd/pod.t (from r36700, branches/update_pod/t/doc/pod.t)
==============================================================================
--- branches/update_pod/t/doc/pod.t	Fri Feb 13 23:58:16 2009	(r36700, copy source)
+++ branches/update_pod/t/codingstd/pod.t	Sat Feb 14 00:01:25 2009	(r36702)
@@ -145,15 +145,15 @@
 
 =head1 NAME
 
-t/doc/pod.t - Pod document syntax tests
+t/codingstd/pod.t - Pod document syntax tests
 
 =head1 SYNOPSIS
 
     # test all files
-    % prove t/doc/pod.t
+    % prove t/codingstd/pod.t
 
     # test specific files
-    % perl t/doc/pod.t perl_module.pm perl_file.pl
+    % perl t/codingstd/pod.t perl_module.pm perl_file.pl
 
 =head1 DESCRIPTION
 

Deleted: branches/update_pod/t/doc/opcode-doc.t
==============================================================================
--- branches/update_pod/t/doc/opcode-doc.t	Sat Feb 14 00:01:25 2009	(r36701)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,97 +0,0 @@
-#! perl
-# Copyright (C) 2001-2005, The Perl Foundation.
-# $Id$
-
-use strict;
-use warnings;
-use lib qw( . lib ../lib ../../lib );
-use Test::More tests => 1;
-
-=head1 NAME
-
-t/perl/opcode-doc.t - check opcode documentation
-
-=head1 SYNOPSIS
-
-    % prove t/perl/opcode-doc.t
-
-=head1 DESCRIPTION
-
-Checks whether all opcodes are documented.
-
-=cut
-
-my @docerr;
-
-sub slurp {
-    my ($filename) = @_;
-
-    open my $FILE, '<', "$filename" or die "can't open '$filename' for reading";
-    my @file = <$FILE>;
-    close $FILE;
-    return @file;
-}
-
-sub analyse {
-    my ( $filename, $ops ) = @_;
-
-    my %file;
-
-    foreach my $op ( keys %$ops ) {
-        my $args = $ops->{$op};
-        next if $op =~ /^DELETED/;
-        next if $op =~ /^isgt/;      # doced but rewritten
-        next if $op =~ /^isge/;
-        foreach my $arg ( keys %$args ) {
-            my $e   = $args->{$arg};
-            my $val = $e->{status};
-            next if $val == 3;       # doc & impl
-            $file{ $e->{def} } = "no documentation for $op($arg)" if exists $e->{def};
-            $file{ $e->{doc} } = "no definition of $op($arg)"     if exists $e->{doc};
-        }
-    }
-
-    foreach my $line ( sort { $a <=> $b } keys %file ) {
-        push @docerr, "$filename:$line: $file{$line}\n";
-    }
-}
-
-sub check_op_doc {
-    my ($filename) = @_;
-
-    my @file = slurp($filename);
-    my %op;
-    my $lineno = 0;
-
-    foreach my $line (@file) {
-        ++$lineno;
-        if ( my ($item) = $line =~ /^=item\s+(.+\(.*)/ ) {
-            if ( $item =~ /^([BC])\<(.*)\>\s*\((.*?)\)/ ) {
-                print "$filename:$lineno: use B<...> instead of C<...>\n"
-                    if $1 eq "C";
-                my ( $op, $args ) = ( $2, $3 );
-                $args =~ s!\s*/\*.*?\*/!!;    # del C comment in args
-                $op{$op}{$args}{doc} = $lineno;
-                $op{$op}{$args}{status} |= 1;
-            }
-        }
-        elsif ( $line =~ /^(inline )?\s*op\s*(\S+)\s*\((.*?)\)/ ) {
-            $op{$2}{$3}{def} = $lineno;
-            $op{$2}{$3}{status} |= 2;
-        }
-    }
-    analyse( $filename, \%op );
-}
-
-foreach my $file (<ops/*.ops>) {
-    check_op_doc $file;
-}
-
-ok( !@docerr, 'opcode documentation' ) or diag("Opcode documentation errors:\n at docerr");
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:

Deleted: branches/update_pod/t/doc/pod.t
==============================================================================
--- branches/update_pod/t/doc/pod.t	Sat Feb 14 00:01:25 2009	(r36701)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,172 +0,0 @@
-#! perl
-# Copyright (C) 2001-2009, The Perl Foundation.
-# $Id$
-
-use strict;
-use warnings;
-
-use Carp;
-use Test::More;
-use ExtUtils::Manifest qw(maniread);
-use lib qw( lib );
-use Parrot::Config;
-use Parrot::Test::Pod::Util qw(
-    identify_files_for_POD_testing
-);
-
-BEGIN {
-    eval 'use Pod::Simple';
-    if ($@) {
-        plan skip_all => 'Pod::Simple not installed';
-        exit;
-    }
-}
-
-plan tests => 2;
-
-# RT #44437 this should really be using src_dir instead of build_dir but it
-# does not exist (yet)
-my $build_dir    = $PConfig{build_dir};
-#print STDERR $build_dir, "\n";
-
-croak "Cannot run test if build_dir does not yet exist"
-    unless -d $build_dir;
-croak "Test cannot be run unless MANIFEST exists in build dir"
-    unless -f "$build_dir/MANIFEST";
-croak "Test cannot be run unless MANIFEST exists in build dir"
-    unless -f "$build_dir/MANIFEST.generated";
-
-my $manifest     = maniread("$build_dir/MANIFEST");
-my $manifest_gen = maniread("$build_dir/MANIFEST.generated");
-
-my $need_testing_ref = identify_files_for_POD_testing( {
-    argv            => [ @ARGV ],
-    manifest        => $manifest,
-    manifest_gen    => $manifest_gen,
-    build_dir       => $build_dir,
-    second_analysis => \&second_analysis,
-} );
-
-my (@failed_syntax, @empty_description);
-
-foreach my $file ( @{ $need_testing_ref } ) {
-    # skip files with valid POD
-    if (file_pod_ok($file)) {
-        #check DESCRIPTION section on valid POD files
-        push @empty_description, $file if empty_description($file);
-    }
-    else {
-        # report whatever is not skipped
-        push @failed_syntax, $file;
-    }
-}
-
-my $bad_syntax_files        = join( "\n", @failed_syntax );
-my $empty_description_files = join( "\n", @empty_description);
-my $nempty_description      = scalar( @empty_description );
-
-# only ok if everything passed
-is( $bad_syntax_files, q{}, 'Pod syntax correct' );
-
-TODO: {
-    local $TODO = "not quite done yet";
-    is(
-        $empty_description_files,
-        q{},
-        'All Pod files have non-empty DESCRIPTION sections'
-    );
-}
-
-diag("You should use podchecker to check the failed files.\n")
-    if $bad_syntax_files;
-
-diag("Found $nempty_description files without DESCRIPTION sections.\n")
-    if $nempty_description;
-
-#################### SUBROUTINES ####################
-
-sub second_analysis {
-    my ($files_needing_analysis, $build_dir) = @_;
-    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;
-        }
-    }
-    return $files_needing_analysis;
-}
-
-# Pulled from Test::Pod
-sub file_pod_ok {
-    my $file    = shift;
-    my $checker = Pod::Simple->new;
-
-    $checker->output_string( \my $trash );      # Ignore any output
-    $checker->parse_file($file);
-
-    return !$checker->any_errata_seen;
-}
-
-sub empty_description {
-    my $file = shift;
-
-    use Pod::Simple::PullParser;
-    my $parser = Pod::Simple::PullParser->new;
-    $parser->set_source( $file );
-    my $description = $parser->get_description;
-
-    if ( $description =~ m{^\s*$}m ) {
-        return 1;
-    }
-
-    return 0;
-}
-
-
-=head1 NAME
-
-t/doc/pod.t - Pod document syntax tests
-
-=head1 SYNOPSIS
-
-    # test all files
-    % prove t/doc/pod.t
-
-    # test specific files
-    % perl t/doc/pod.t perl_module.pm perl_file.pl
-
-=head1 DESCRIPTION
-
-Tests the Pod syntax for all files listed in F<MANIFEST> and
-F<MANIFEST.generated> that appear to contain Pod markup. If any files
-contain invalid POD markup, they are reported in the test output.
-Use C<podchecker> to ferret out individual issues.
-
-=cut
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:


More information about the parrot-commits mailing list