diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/TAP/Parser.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/TAP/Parser.pm | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/Master/tlpkg/tlperl/lib/TAP/Parser.pm b/Master/tlpkg/tlperl/lib/TAP/Parser.pm index 95909032418..1ebb0db969c 100644 --- a/Master/tlpkg/tlperl/lib/TAP/Parser.pm +++ b/Master/tlpkg/tlperl/lib/TAP/Parser.pm @@ -1,9 +1,8 @@ package TAP::Parser; use strict; -use vars qw($VERSION @ISA); +use warnings; -use TAP::Base (); use TAP::Parser::Grammar (); use TAP::Parser::Result (); use TAP::Parser::ResultFactory (); @@ -18,17 +17,21 @@ use TAP::Parser::SourceHandler::Handle (); use Carp qw( confess ); +use base 'TAP::Base'; + +=encoding utf8 + =head1 NAME TAP::Parser - Parse L<TAP|Test::Harness::TAP> output =head1 VERSION -Version 3.26 +Version 3.30 =cut -$VERSION = '3.26'; +our $VERSION = '3.30'; my $DEFAULT_TAP_VERSION = 12; my $MAX_TAP_VERSION = 13; @@ -42,8 +45,6 @@ END { } BEGIN { # making accessors - @ISA = qw(TAP::Base); - __PACKAGE__->mk_methods( qw( _iterator @@ -174,7 +175,7 @@ I<NEW to 3.18>. If set, C<sources> must be a hashref containing the names of the L<TAP::Parser::SourceHandler>s to load and/or configure. The values are a -hash of configuration that will be accessible to to the source handlers via +hash of configuration that will be accessible to the source handlers via L<TAP::Parser::Source/config_for>. For example: @@ -638,7 +639,7 @@ C<$result> object. Returns a list of pragmas each of which is a + or - followed by the pragma name. - + =head2 C<comment> methods if ( $result->is_comment ) { ... } @@ -795,7 +796,11 @@ but had a TODO directive, it will be counted as a passed test. =cut -sub passed { @{ shift->{passed} } } +sub passed { + return @{ $_[0]->{passed} } + if ref $_[0]->{passed}; + return wantarray ? 1 .. $_[0]->{passed} : $_[0]->{passed}; +} =head3 C<failed> @@ -822,7 +827,11 @@ regardless of whether or not a TODO directive was found. =cut -sub actual_passed { @{ shift->{actual_passed} } } +sub actual_passed { + return @{ $_[0]->{actual_passed} } + if ref $_[0]->{actual_passed}; + return wantarray ? 1 .. $_[0]->{actual_passed} : $_[0]->{actual_passed}; +} *actual_ok = \&actual_passed; =head3 C<actual_ok> @@ -1496,6 +1505,17 @@ sub _finish { } $self->is_good_plan(0) unless defined $self->is_good_plan; + + unless ( $self->parse_errors ) { + # Optimise storage where possible + if ( $self->tests_run == @{$self->{passed}} ) { + $self->{passed} = $self->tests_run; + } + if ( $self->tests_run == @{$self->{actual_passed}} ) { + $self->{actual_passed} = $self->tests_run; + } + } + return $self; } @@ -1745,7 +1765,7 @@ so without sub-classing C<TAP::Parser> by setting L</iterator_factory_class>. If you just need to customize the objects on creation, subclass L<TAP::Parser> and override L</make_iterator_factory>. -Note that L</make_source> & L</make_perl_source> have been I<DEPRECATED> and +Note that C<make_source> & C<make_perl_source> have been I<DEPRECATED> and are now removed. =head3 Iterators |