r17676 - in /trunk/libtest-harness-perl: ./ debian/ lib/App/ lib/App/Prove/ lib/TAP/ lib/TAP/Formatter/ lib/TAP/Formatter/Console/ lib/TAP/Parser/ lib/TAP/Parser/Iterator/ lib/TAP/Parser/Result/ lib/TAP/Parser/Source/ lib/TAP/Parser/YAMLish/ lib/Test/ t/ t/sample-tests/

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Mon Mar 17 00:38:54 UTC 2008


Author: gregoa-guest
Date: Mon Mar 17 00:38:53 2008
New Revision: 17676

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=17676
Log:
New upstream release.

Added:
    trunk/libtest-harness-perl/lib/TAP/Parser/Result/Pragma.pm
      - copied unchanged from r17675, branches/upstream/libtest-harness-perl/current/lib/TAP/Parser/Result/Pragma.pm
    trunk/libtest-harness-perl/t/sample-tests/strict
      - copied unchanged from r17675, branches/upstream/libtest-harness-perl/current/t/sample-tests/strict
Modified:
    trunk/libtest-harness-perl/Changes
    trunk/libtest-harness-perl/MANIFEST
    trunk/libtest-harness-perl/META.yml
    trunk/libtest-harness-perl/debian/changelog
    trunk/libtest-harness-perl/lib/App/Prove.pm
    trunk/libtest-harness-perl/lib/App/Prove/State.pm
    trunk/libtest-harness-perl/lib/TAP/Base.pm
    trunk/libtest-harness-perl/lib/TAP/Formatter/Color.pm
    trunk/libtest-harness-perl/lib/TAP/Formatter/Console.pm
    trunk/libtest-harness-perl/lib/TAP/Formatter/Console/ParallelSession.pm
    trunk/libtest-harness-perl/lib/TAP/Formatter/Console/Session.pm
    trunk/libtest-harness-perl/lib/TAP/Harness.pm
    trunk/libtest-harness-perl/lib/TAP/Parser.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Aggregator.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Grammar.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Iterator.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Iterator/Array.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Iterator/Process.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Iterator/Stream.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Multiplexer.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Result.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Result/Bailout.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Result/Comment.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Result/Plan.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Result/Test.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Result/Unknown.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Result/Version.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Result/YAML.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Source.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Source/Perl.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/Utils.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/YAMLish/Reader.pm
    trunk/libtest-harness-perl/lib/TAP/Parser/YAMLish/Writer.pm
    trunk/libtest-harness-perl/lib/Test/Harness.pm
    trunk/libtest-harness-perl/t/000-load.t
    trunk/libtest-harness-perl/t/grammar.t
    trunk/libtest-harness-perl/t/parse.t
    trunk/libtest-harness-perl/t/regression.t

Modified: trunk/libtest-harness-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/Changes?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/Changes (original)
+++ trunk/libtest-harness-perl/Changes Mon Mar 17 00:38:53 2008
@@ -1,4 +1,9 @@
 Revision history for Test-Harness
+
+3.10    2008-02-26
+        - fix undefined value warnings with bleadperl.
+        - added pragma support.
+        - fault unknown TAP tokens under strict pragma.
 
 3.09    2008-02-10
         - support for HARNESS_PERL_SWITCHES containing things like 

Modified: trunk/libtest-harness-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/MANIFEST?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/MANIFEST (original)
+++ trunk/libtest-harness-perl/MANIFEST Mon Mar 17 00:38:53 2008
@@ -35,6 +35,7 @@
 lib/TAP/Parser/Result/Bailout.pm
 lib/TAP/Parser/Result/Comment.pm
 lib/TAP/Parser/Result/Plan.pm
+lib/TAP/Parser/Result/Pragma.pm
 lib/TAP/Parser/Result/Test.pm
 lib/TAP/Parser/Result/Unknown.pm
 lib/TAP/Parser/Result/Version.pm
@@ -132,6 +133,7 @@
 t/sample-tests/skipall_v13
 t/sample-tests/space_after_plan
 t/sample-tests/stdout_stderr
+t/sample-tests/strict
 t/sample-tests/switches
 t/sample-tests/taint
 t/sample-tests/taint_warn

Modified: trunk/libtest-harness-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/META.yml?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/META.yml (original)
+++ trunk/libtest-harness-perl/META.yml Mon Mar 17 00:38:53 2008
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                Test-Harness
-version:             3.09
+version:             3.10
 abstract:            ~
 license:             perl
 author:              ~

Modified: trunk/libtest-harness-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/debian/changelog?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/debian/changelog (original)
+++ trunk/libtest-harness-perl/debian/changelog Mon Mar 17 00:38:53 2008
@@ -1,3 +1,9 @@
+libtest-harness-perl (3.10-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregor+debian at comodo.priv.at>  Mon, 17 Mar 2008 01:37:22 +0100
+
 libtest-harness-perl (3.09-1) unstable; urgency=low
 
   * New upstream release.

Modified: trunk/libtest-harness-perl/lib/App/Prove.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/App/Prove.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/App/Prove.pm (original)
+++ trunk/libtest-harness-perl/lib/App/Prove.pm Mon Mar 17 00:38:53 2008
@@ -16,11 +16,11 @@
 
 =head1 VERSION
 
-Version 3.09
-
-=cut
-
-$VERSION = '3.09';
+Version 3.10
+
+=cut
+
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-harness-perl/lib/App/Prove/State.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/App/Prove/State.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/App/Prove/State.pm (original)
+++ trunk/libtest-harness-perl/lib/App/Prove/State.pm Mon Mar 17 00:38:53 2008
@@ -20,11 +20,11 @@
 
 =head1 VERSION
 
-Version 3.09
-
-=cut
-
-$VERSION = '3.09';
+Version 3.10
+
+=cut
+
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-harness-perl/lib/TAP/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Base.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Base.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Base.pm Mon Mar 17 00:38:53 2008
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 my $GOT_TIME_HIRES;
 

Modified: trunk/libtest-harness-perl/lib/TAP/Formatter/Color.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Formatter/Color.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Formatter/Color.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Formatter/Color.pm Mon Mar 17 00:38:53 2008
@@ -70,11 +70,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-harness-perl/lib/TAP/Formatter/Console.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Formatter/Console.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Formatter/Console.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Formatter/Console.pm Mon Mar 17 00:38:53 2008
@@ -52,11 +52,11 @@
 
 =head1 VERSION
 
-Version 3.09
-
-=cut
-
-$VERSION = '3.09';
+Version 3.10
+
+=cut
+
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-harness-perl/lib/TAP/Formatter/Console/ParallelSession.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Formatter/Console/ParallelSession.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Formatter/Console/ParallelSession.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Formatter/Console/ParallelSession.pm Mon Mar 17 00:38:53 2008
@@ -48,11 +48,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-harness-perl/lib/TAP/Formatter/Console/Session.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Formatter/Console/Session.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Formatter/Console/Session.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Formatter/Console/Session.pm Mon Mar 17 00:38:53 2008
@@ -36,11 +36,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-harness-perl/lib/TAP/Harness.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Harness.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Harness.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Harness.pm Mon Mar 17 00:38:53 2008
@@ -22,11 +22,11 @@
 
 =head1 VERSION
 
-Version 3.09
-
-=cut
-
-$VERSION = '3.09';
+Version 3.10
+
+=cut
+
+$VERSION = '3.10';
 
 $ENV{HARNESS_ACTIVE}  = 1;
 $ENV{HARNESS_VERSION} = $VERSION;

Modified: trunk/libtest-harness-perl/lib/TAP/Parser.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser.pm Mon Mar 17 00:38:53 2008
@@ -9,7 +9,8 @@
 use TAP::Parser::Source       ();
 use TAP::Parser::Source::Perl ();
 use TAP::Parser::Iterator     ();
-use Carp                      ();
+
+use Carp qw( confess );
 
 @ISA = qw(TAP::Base);
 
@@ -19,11 +20,11 @@
 
 =head1 VERSION
 
-Version 3.09
-
-=cut
-
-$VERSION = '3.09';
+Version 3.10
+
+=cut
+
+$VERSION = '3.10';
 
 my $DEFAULT_TAP_VERSION = 12;
 my $MAX_TAP_VERSION     = 13;
@@ -411,6 +412,10 @@
 
  1..42
 
+=item * Pragma
+
+ pragma +strict
+
 =item * Test
 
  ok 3 - We should start with some foobar!
@@ -521,6 +526,18 @@
 If a SKIP directive was included with the plan, this method will return the
 explanation, if any.
 
+=head2 C<pragma> methods
+
+ if ( $result->is_pragma ) { ... }
+
+If the above evaluates as true, the following methods will be available on the
+C<$result> object.
+
+=head3 C<pragmas>
+
+Returns a list of pragmas each of which is a + or - followed by the
+pragma name.
+ 
 =head2 C<commment> methods
 
  if ( $result->is_comment ) { ... }
@@ -781,6 +798,47 @@
 =cut
 
 sub skipped { @{ shift->{skipped} } }
+
+=head2 Pragmas
+
+=head3 C<pragma>
+
+Get or set a pragma. To get the state of a pragma:
+
+  if ( $p->pragma('strict') ) {
+      # be strict
+  }
+
+To set the state of a pragma:
+
+  $p->pragma('strict', 1); # enable strict mode
+
+=cut
+
+sub pragma {
+    my ( $self, $pragma ) = splice @_, 0, 2;
+
+    return $self->{pragma}->{$pragma} unless @_;
+
+    if ( my $state = shift ) {
+        $self->{pragma}->{$pragma} = 1;
+    }
+    else {
+        delete $self->{pragma}->{$pragma};
+    }
+
+    return;
+}
+
+=head3 C<pragmas>
+
+Get a list of all the currently enabled pragmas:
+
+  my @pragmas_enabled = $p->pragmas;
+
+=cut
+
+sub pragmas { sort keys %{ shift->{pragma} || {} } }
 
 =head2 Summary Results
 
@@ -965,12 +1023,31 @@
     my %state_globals = (
         comment => {},
         bailout => {},
+        yaml    => {},
         version => {
             act => sub {
-                my ($version) = @_;
                 $self->_add_error(
                     'If TAP version is present it must be the first line of output'
                 );
+            },
+        },
+        unknown => {
+            act => sub {
+                my $unk = shift;
+                if ( $self->pragma('strict') ) {
+                    $self->_add_error(
+                        'Unknown TAP token: "' . $unk->raw . '"' );
+                }
+            },
+        },
+        pragma => {
+            act => sub {
+                my ($pragma) = @_;
+                for my $pr ( $pragma->pragmas ) {
+                    if ( $pr =~ /^ ([-+])(\w+) $/x ) {
+                        $self->pragma( $2, $1 eq '+' );
+                    }
+                }
             },
         },
     );
@@ -1039,9 +1116,7 @@
                   } => $number;
             },
         },
-        yaml => {
-            act => sub { },
-        },
+        yaml => { act => sub { }, },
     );
 
     # Each state contains a hash the keys of which match a token type. For
@@ -1125,7 +1200,7 @@
     );
 
     # Apply globals and defaults to state table
-    for my $name ( sort keys %states ) {
+    for my $name ( keys %states ) {
 
         # Merge with globals
         my $st = { %state_globals, %{ $states{$name} } };
@@ -1167,7 +1242,6 @@
     my $next_state = sub {
         my $token = shift;
         my $type  = $token->type;
-        my $count = 1;
         TRANS: {
             my $state_spec = $state_table->{$state}
               or die "Illegal state: $state";
@@ -1183,6 +1257,9 @@
                 elsif ( my $goto = $next->{goto} ) {
                     $state = $goto;
                 }
+            }
+            else {
+                confess("Unhandled token type: $type\n");
             }
         }
         return $token;

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Aggregator.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Aggregator.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Aggregator.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Aggregator.pm Mon Mar 17 00:38:53 2008
@@ -10,11 +10,11 @@
 
 =head1 VERSION
 
-Version 3.09
-
-=cut
-
-$VERSION = '3.09';
+Version 3.10
+
+=cut
+
+$VERSION = '3.10';
 
 =head1 SYNOPSIS
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Grammar.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Grammar.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Grammar.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Grammar.pm Mon Mar 17 00:38:53 2008
@@ -12,11 +12,11 @@
 
 =head1 VERSION
 
-Version 3.09
-
-=cut
-
-$VERSION = '3.09';
+Version 3.10
+
+=cut
+
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 
@@ -182,6 +182,15 @@
                 my ( $self, $line ) = @_;
                 my ( $pad, $marker ) = ( $1, $2 );
                 return $self->_make_yaml_token( $pad, $marker );
+            },
+        },
+        pragma => {
+            syntax =>
+              qr/^ pragma \s+ ( [-+] \w+ \s* (?: , \s* [-+] \w+ \s* )* ) $/x,
+            handler => sub {
+                my ( $self, $line ) = @_;
+                my $pragmas = $1;
+                return $self->_make_pragma_token( $line, $pragmas );
             },
         },
     );
@@ -372,7 +381,7 @@
         ok          => $ok,
         test_num    => $num,
         description => _trim($desc),
-        directive   => uc($dir),
+        directive   => uc( defined $dir ? $dir : '' ),
         explanation => _trim($explanation),
         raw         => $line,
         type        => 'test',
@@ -439,6 +448,15 @@
     };
 }
 
+sub _make_pragma_token {
+    my ( $self, $line, $pragmas ) = @_;
+    return {
+        type    => 'pragma',
+        raw     => $line,
+        pragmas => [ split /\s*,\s*/, _trim($pragmas) ],
+    };
+}
+
 sub _trim {
     my $data = shift;
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Iterator.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Iterator.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Iterator.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Iterator.pm Mon Mar 17 00:38:53 2008
@@ -13,11 +13,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 SYNOPSIS
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Iterator/Array.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Iterator/Array.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Iterator/Array.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Iterator/Array.pm Mon Mar 17 00:38:53 2008
@@ -11,11 +11,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 SYNOPSIS
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Iterator/Process.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Iterator/Process.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Iterator/Process.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Iterator/Process.pm Mon Mar 17 00:38:53 2008
@@ -19,11 +19,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 SYNOPSIS
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Iterator/Stream.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Iterator/Stream.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Iterator/Stream.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Iterator/Stream.pm Mon Mar 17 00:38:53 2008
@@ -11,11 +11,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 SYNOPSIS
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Multiplexer.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Multiplexer.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Multiplexer.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Multiplexer.pm Mon Mar 17 00:38:53 2008
@@ -14,11 +14,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 SYNOPSIS
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Result.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Result.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Result.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Result.pm Mon Mar 17 00:38:53 2008
@@ -6,14 +6,30 @@
 use TAP::Parser::Result::Bailout ();
 use TAP::Parser::Result::Comment ();
 use TAP::Parser::Result::Plan    ();
+use TAP::Parser::Result::Pragma  ();
 use TAP::Parser::Result::Test    ();
 use TAP::Parser::Result::Unknown ();
 use TAP::Parser::Result::Version ();
 use TAP::Parser::Result::YAML    ();
 
+# note that this is bad.  Makes it very difficult to subclass, but then, it
+# would be a lot of work to subclass this system.
+my %class_for;
+
 BEGIN {
+    %class_for = (
+        plan    => 'TAP::Parser::Result::Plan',
+        pragma  => 'TAP::Parser::Result::Pragma',
+        test    => 'TAP::Parser::Result::Test',
+        comment => 'TAP::Parser::Result::Comment',
+        bailout => 'TAP::Parser::Result::Bailout',
+        version => 'TAP::Parser::Result::Version',
+        unknown => 'TAP::Parser::Result::Unknown',
+        yaml    => 'TAP::Parser::Result::YAML',
+    );
+
     no strict 'refs';
-    foreach my $token (qw( plan comment test bailout version unknown yaml )) {
+    for my $token ( keys %class_for ) {
         my $method = "is_$token";
         *$method = sub { return $token eq shift->type };
     }
@@ -27,11 +43,11 @@
 
 =head1 VERSION
 
-Version 3.09
-
-=cut
-
-$VERSION = '3.09';
+Version 3.10
+
+=cut
+
+$VERSION = '3.10';
 
 =head2 DESCRIPTION
 
@@ -40,18 +56,6 @@
 only and should not be relied upon.
 
 =cut
-
-# note that this is bad.  Makes it very difficult to subclass, but then, it
-# would be a lot of work to subclass this system.
-my %class_for = (
-    plan    => 'TAP::Parser::Result::Plan',
-    test    => 'TAP::Parser::Result::Test',
-    comment => 'TAP::Parser::Result::Comment',
-    bailout => 'TAP::Parser::Result::Bailout',
-    version => 'TAP::Parser::Result::Version',
-    unknown => 'TAP::Parser::Result::Unknown',
-    yaml    => 'TAP::Parser::Result::YAML',
-);
 
 ##############################################################################
 
@@ -89,11 +93,17 @@
 
  1..3
 
+=item * C<is_pragma>
+
+Indicates whether or not this is a pragma line.
+
+ pragma +strict
+
 =item * C<is_test>
 
 Indicates whether or not this is a test line.
 
- is $foo, $bar, $description;
+ ok 1 Is OK!
 
 =item * C<is_comment>
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Result/Bailout.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Result/Bailout.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Result/Bailout.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Result/Bailout.pm Mon Mar 17 00:38:53 2008
@@ -12,11 +12,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Result/Comment.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Result/Comment.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Result/Comment.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Result/Comment.pm Mon Mar 17 00:38:53 2008
@@ -12,11 +12,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Result/Plan.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Result/Plan.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Result/Plan.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Result/Plan.pm Mon Mar 17 00:38:53 2008
@@ -12,11 +12,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Result/Test.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Result/Test.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Result/Test.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Result/Test.pm Mon Mar 17 00:38:53 2008
@@ -14,11 +14,11 @@
 
 =head1 VERSION
 
-Version 3.09
-
-=cut
-
-$VERSION = '3.09';
+Version 3.10
+
+=cut
+
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Result/Unknown.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Result/Unknown.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Result/Unknown.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Result/Unknown.pm Mon Mar 17 00:38:53 2008
@@ -14,11 +14,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Result/Version.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Result/Version.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Result/Version.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Result/Version.pm Mon Mar 17 00:38:53 2008
@@ -8,26 +8,26 @@
 
 =head1 NAME
 
-TAP::Parser::Result::Version - TAP version result token.
+TAP::Parser::Result::Version - TAP syntax version token.
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 
 This is a subclass of L<TAP::Parser::Result>.  A token of this class will be
 returned if a version line is encountered.
 
- TAP version 4
+ TAP version 13
  ok 1
  not ok 2
 
-The first version of TAP to include an explicit version number is 4.
+The first version of TAP to include an explicit version number is 13.
 
 =head1 OVERRIDDEN METHODS
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Result/YAML.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Result/YAML.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Result/YAML.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Result/YAML.pm Mon Mar 17 00:38:53 2008
@@ -12,11 +12,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Source.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Source.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Source.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Source.pm Mon Mar 17 00:38:53 2008
@@ -14,11 +14,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Source/Perl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Source/Perl.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Source/Perl.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Source/Perl.pm Mon Mar 17 00:38:53 2008
@@ -16,11 +16,11 @@
 
 =head1 VERSION
 
-Version 3.09
-
-=cut
-
-$VERSION = '3.09';
+Version 3.10
+
+=cut
+
+$VERSION = '3.10';
 
 =head1 DESCRIPTION
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/Utils.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/Utils.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/Utils.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/Utils.pm Mon Mar 17 00:38:53 2008
@@ -13,11 +13,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 =head1 SYNOPSIS
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/YAMLish/Reader.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/YAMLish/Reader.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/YAMLish/Reader.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/YAMLish/Reader.pm Mon Mar 17 00:38:53 2008
@@ -4,7 +4,7 @@
 
 use vars qw{$VERSION};
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 # TODO:
 #   Handle blessed object syntax
@@ -277,7 +277,7 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =head1 SYNOPSIS
 

Modified: trunk/libtest-harness-perl/lib/TAP/Parser/YAMLish/Writer.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/TAP/Parser/YAMLish/Writer.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/TAP/Parser/YAMLish/Writer.pm (original)
+++ trunk/libtest-harness-perl/lib/TAP/Parser/YAMLish/Writer.pm Mon Mar 17 00:38:53 2008
@@ -4,7 +4,7 @@
 
 use vars qw{$VERSION};
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 my $ESCAPE_CHAR = qr{ [ \x00-\x1f \" ] }x;
 my $ESCAPE_KEY  = qr{ (?: ^\W ) | $ESCAPE_CHAR }x;
@@ -149,7 +149,7 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =head1 SYNOPSIS
 

Modified: trunk/libtest-harness-perl/lib/Test/Harness.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/lib/Test/Harness.pm?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/lib/Test/Harness.pm (original)
+++ trunk/libtest-harness-perl/lib/Test/Harness.pm Mon Mar 17 00:38:53 2008
@@ -43,11 +43,11 @@
 
 =head1 VERSION
 
-Version 3.09
+Version 3.10
 
 =cut
 
-$VERSION = '3.09';
+$VERSION = '3.10';
 
 # Backwards compatibility for exportable variable names.
 *verbose  = *Verbose;

Modified: trunk/libtest-harness-perl/t/000-load.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/t/000-load.t?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/t/000-load.t (original)
+++ trunk/libtest-harness-perl/t/000-load.t Mon Mar 17 00:38:53 2008
@@ -3,7 +3,7 @@
 use strict;
 use lib 't/lib';
 
-use Test::More tests => 60;
+use Test::More tests => 62;
 
 BEGIN {
 
@@ -28,6 +28,7 @@
       TAP::Parser::Result::Bailout
       TAP::Parser::Result::Comment
       TAP::Parser::Result::Plan
+      TAP::Parser::Result::Pragma
       TAP::Parser::Result::Test
       TAP::Parser::Result::Unknown
       TAP::Parser::Result::Version

Modified: trunk/libtest-harness-perl/t/grammar.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/t/grammar.t?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/t/grammar.t (original)
+++ trunk/libtest-harness-perl/t/grammar.t Mon Mar 17 00:38:53 2008
@@ -3,7 +3,7 @@
 use strict;
 use lib 't/lib';
 
-use Test::More tests => 81;
+use Test::More tests => 94;
 
 use TAP::Parser::Grammar;
 use TAP::Parser::Iterator::Array;
@@ -41,8 +41,8 @@
 # why.  We'll still use the instance because that should be forward
 # compatible.
 
-my @V12 = qw(bailout comment plan simple_test test version);
-my @V13 = ( @V12, 'yaml' );
+my @V12 = sort qw(bailout comment plan simple_test test version);
+my @V13 = sort ( @V12, 'pragma', 'yaml' );
 
 can_ok $grammar, 'token_types';
 ok my @types = sort( $grammar->token_types ),
@@ -268,6 +268,56 @@
 is_deeply $token, $expected,
   '... and the token should contain the correct data';
 
+# pragmas
+
+my $pragma = 'pragma +strict';
+like $pragma, $syntax_for{'pragma'}, 'Pragmas should match the pragma syntax';
+
+$stream->put($pragma);
+ok $token = $grammar->tokenize,
+  '... and calling it with data should return a token';
+
+$expected = {
+    'type'    => 'pragma',
+    'raw'     => $pragma,
+    'pragmas' => ['+strict'],
+};
+
+is_deeply $token, $expected,
+  '... and the token should contain the correct data';
+
+$pragma = 'pragma +strict,-foo';
+like $pragma, $syntax_for{'pragma'}, 'Pragmas should match the pragma syntax';
+
+$stream->put($pragma);
+ok $token = $grammar->tokenize,
+  '... and calling it with data should return a token';
+
+$expected = {
+    'type'    => 'pragma',
+    'raw'     => $pragma,
+    'pragmas' => [ '+strict', '-foo' ],
+};
+
+is_deeply $token, $expected,
+  '... and the token should contain the correct data';
+
+$pragma = 'pragma  +strict  ,  -foo ';
+like $pragma, $syntax_for{'pragma'}, 'Pragmas should match the pragma syntax';
+
+$stream->put($pragma);
+ok $token = $grammar->tokenize,
+  '... and calling it with data should return a token';
+
+$expected = {
+    'type'    => 'pragma',
+    'raw'     => $pragma,
+    'pragmas' => [ '+strict', '-foo' ],
+};
+
+is_deeply $token, $expected,
+  '... and the token should contain the correct data';
+
 # coverage tests
 
 # set_version
@@ -281,7 +331,7 @@
         $grammar->set_version('no_such_version');
     };
 
-    unless (is @die, 1, 'set_version with bad version') {
+    unless ( is @die, 1, 'set_version with bad version' ) {
         diag " >>> $_ <<<\n" for @die;
     }
 

Modified: trunk/libtest-harness-perl/t/parse.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/t/parse.t?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/t/parse.t (original)
+++ trunk/libtest-harness-perl/t/parse.t Mon Mar 17 00:38:53 2008
@@ -3,16 +3,16 @@
 use strict;
 
 BEGIN {
-    if( $ENV{PERL_CORE} ) {
+    if ( $ENV{PERL_CORE} ) {
         chdir 't';
-        @INC = ('../lib', 'lib');
+        @INC = ( '../lib', 'lib' );
     }
     else {
-	use lib 't/lib';
-    }
-}
-
-use Test::More tests => 260;
+        use lib 't/lib';
+    }
+}
+
+use Test::More tests => 268;
 use IO::c55Capture;
 
 use File::Spec;
@@ -29,9 +29,10 @@
     return @results;
 }
 
-my ( $PARSER, $PLAN, $TEST, $COMMENT, $BAILOUT, $UNKNOWN, $YAML, $VERSION ) = qw(
+my ( $PARSER, $PLAN, $PRAGMA, $TEST, $COMMENT, $BAILOUT, $UNKNOWN, $YAML, $VERSION ) = qw(
   TAP::Parser
   TAP::Parser::Result::Plan
+  TAP::Parser::Result::Pragma
   TAP::Parser::Result::Test
   TAP::Parser::Result::Comment
   TAP::Parser::Result::Bailout
@@ -624,8 +625,10 @@
     # coverage test of perl source with switches
 
     my $parser = TAP::Parser->new(
-        {   source => File::Spec->catfile( ($ENV{PERL_CORE} ? 'lib' : 't'),
-					   'sample-tests', 'simple' ),
+        {   source => File::Spec->catfile(
+                ( $ENV{PERL_CORE} ? 'lib' : 't' ),
+                'sample-tests', 'simple'
+            ),
         }
     );
 
@@ -988,3 +991,30 @@
       qr/Panic: planned test count [(]1001[)] did not equal sum of passed [(]0[)] and failed [(]2[)] tests!/,
       '...and the message is as we expect';
 }
+
+{
+
+    # Sanity check on state table
+
+    my $parser      = TAP::Parser->new( { tap => "1..1\nok 1\n" } );
+    my $state_table = $parser->_make_state_table;
+    my @states      = sort keys %$state_table;
+    my @expect      = sort qw(
+      bailout comment plan pragma test unknown version yaml
+    );
+
+    my %reachable = ( INIT => 1 );
+
+    for my $name (@states) {
+        my $state      = $state_table->{$name};
+        my @can_handle = sort keys %$state;
+        is_deeply \@can_handle, \@expect, "token types handled in $name";
+        for my $type (@can_handle) {
+            $reachable{$_}++
+              for grep {defined}
+              map      { $state->{$type}->{$_} } qw(goto continue);
+        }
+    }
+
+    is_deeply [ sort keys %reachable ], [@states], "all states reachable";
+}

Modified: trunk/libtest-harness-perl/t/regression.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-harness-perl/t/regression.t?rev=17676&op=diff
==============================================================================
--- trunk/libtest-harness-perl/t/regression.t (original)
+++ trunk/libtest-harness-perl/t/regression.t Mon Mar 17 00:38:53 2008
@@ -2245,6 +2245,48 @@
         wait          => 0,
         version       => 13,
     },
+    strict => {
+        results => [
+            {   is_version => TRUE,
+                raw        => 'TAP version 13',
+            },
+            {   is_plan => TRUE,
+                raw     => '1..1',
+            },
+            {   is_pragma => TRUE,
+                raw       => 'pragma +strict',
+                pragmas   => ['+strict'],
+            },
+            {   is_unknown => TRUE, raw => 'Nonsense!',
+            },
+            {   is_pragma => TRUE,
+                raw       => 'pragma -strict',
+                pragmas   => ['-strict'],
+            },
+            {   is_unknown => TRUE,
+                raw        => "Doesn't matter.",
+            },
+            {   is_test => TRUE,
+                raw     => 'ok 1 All OK',
+            }
+        ],
+        plan          => '1..1',
+        passed        => [1],
+        actual_passed => [1],
+        failed        => [],
+        actual_failed => [],
+        todo          => [],
+        todo_passed   => [],
+        skipped       => [],
+        good_plan     => TRUE,
+        is_good_plan  => TRUE,
+        tests_planned => 1,
+        tests_run     => 1,
+        parse_errors  => ['Unknown TAP token: "Nonsense!"'],
+        'exit'  => 0,    # TODO: Is this right???
+        wait    => 0,
+        version => 13,
+    },
     skipall_nomsg => {
         results => [
             {   is_plan       => TRUE,
@@ -2803,7 +2845,7 @@
         tests_planned => 5,
         tests_run     => 5,
         parse_errors =>
-          [ 'Explicit TAP version must be at least 13. Got version 12' ],
+          ['Explicit TAP version must be at least 13. Got version 12'],
         'exit'  => 0,
         wait    => 0,
         version => 12,
@@ -2883,7 +2925,7 @@
         tests_planned => 5,
         tests_run     => 5,
         parse_errors =>
-          [ 'If TAP version is present it must be the first line of output' ],
+          ['If TAP version is present it must be the first line of output'],
         'exit'  => 0,
         wait    => 0,
         version => 12,
@@ -3121,7 +3163,7 @@
                   "... and $method should return a reasonable value ($test/$count)";
             }
             elsif ( ref $answer ) {
-                is_deeply $result->$method(), $answer,
+                is_deeply scalar( $result->$method() ), $answer,
                   "... and $method should return the correct structure ($test/$count)";
             }
             else {




More information about the Pkg-perl-cvs-commits mailing list