From: Rafael Garcia-Suarez Date: Mon, 28 Jan 2008 13:58:55 +0000 (+0000) Subject: Upgrade to Test::Harnes 3.07 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=53bc175b76e361263ce76e21abe288f4d2208efe;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Test::Harnes 3.07 p4raw-id: //depot/perl@33091 --- diff --git a/lib/App/Prove.pm b/lib/App/Prove.pm index 828aa14..f08b82d 100644 --- a/lib/App/Prove.pm +++ b/lib/App/Prove.pm @@ -15,11 +15,11 @@ App::Prove - Implements the C command. =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION @@ -190,6 +190,7 @@ sub process_args { 'b|blib' => \$self->{blib}, 's|shuffle' => \$self->{shuffle}, 'color!' => \$self->{color}, + 'colour!' => \$self->{color}, 'c' => \$self->{color}, 'harness=s' => \$self->{harness}, 'formatter=s' => \$self->{formatter}, @@ -407,6 +408,7 @@ sub run { $self->_shuffle(@tests) if $self->shuffle; @tests = reverse @tests if $self->backwards; + local $ENV{TEST_VERBOSE} = 1 if $self->verbose; $self->_runtests( $self->_get_args, @tests ); } @@ -449,6 +451,10 @@ sub _get_switches { push @switches, '-w'; } + if ( defined( my $hps = $ENV{HARNESS_PERL_SWITCHES} ) ) { + push @switches, $hps; + } + return @switches ? \@switches : (); } diff --git a/lib/App/Prove/State.pm b/lib/App/Prove/State.pm index c470c9e..a82feb3 100644 --- a/lib/App/Prove/State.pm +++ b/lib/App/Prove/State.pm @@ -20,11 +20,11 @@ App::Prove::State - State storage for the C command. =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION diff --git a/lib/TAP/Base.pm b/lib/TAP/Base.pm index 9919095..1364b9e 100644 --- a/lib/TAP/Base.pm +++ b/lib/TAP/Base.pm @@ -9,11 +9,11 @@ TAP::Base - Base class that provides common functionality to L and =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; my $GOT_TIME_HIRES; diff --git a/lib/TAP/Formatter/Color.pm b/lib/TAP/Formatter/Color.pm index 063fb07..410daf8 100644 --- a/lib/TAP/Formatter/Color.pm +++ b/lib/TAP/Formatter/Color.pm @@ -70,11 +70,11 @@ TAP::Formatter::Color - Run Perl test scripts with color =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION diff --git a/lib/TAP/Formatter/Console.pm b/lib/TAP/Formatter/Console.pm index 9e79d9a..08d9736 100644 --- a/lib/TAP/Formatter/Console.pm +++ b/lib/TAP/Formatter/Console.pm @@ -52,11 +52,11 @@ TAP::Formatter::Console - Harness output delegate for default console output =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION diff --git a/lib/TAP/Formatter/Console/ParallelSession.pm b/lib/TAP/Formatter/Console/ParallelSession.pm index 96ca2cf..6d4f6d7 100644 --- a/lib/TAP/Formatter/Console/ParallelSession.pm +++ b/lib/TAP/Formatter/Console/ParallelSession.pm @@ -48,11 +48,11 @@ TAP::Formatter::Console::ParallelSession - Harness output delegate for parallel =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION diff --git a/lib/TAP/Formatter/Console/Session.pm b/lib/TAP/Formatter/Console/Session.pm index eb2cf50..873f7ee 100644 --- a/lib/TAP/Formatter/Console/Session.pm +++ b/lib/TAP/Formatter/Console/Session.pm @@ -36,11 +36,11 @@ TAP::Formatter::Console::Session - Harness output delegate for default console o =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION diff --git a/lib/TAP/Harness.pm b/lib/TAP/Harness.pm index 9dcd92c..f024607 100644 --- a/lib/TAP/Harness.pm +++ b/lib/TAP/Harness.pm @@ -22,11 +22,11 @@ TAP::Harness - Run test scripts with statistics =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; $ENV{HARNESS_ACTIVE} = 1; $ENV{HARNESS_VERSION} = $VERSION; @@ -330,21 +330,15 @@ sub runtests { my $aggregate = TAP::Parser::Aggregator->new; $self->_make_callback( 'before_runtests', $aggregate ); + $aggregate->start; $self->aggregate_tests( $aggregate, @tests ); + $aggregate->stop; $self->formatter->summary($aggregate); $self->_make_callback( 'after_runtests', $aggregate ); return $aggregate; } -=head3 C - - $harness->aggregate_tests( $aggregate, @tests ); - -Tests will be run in the order found. - -=cut - sub _after_test { my ( $self, $aggregate, $test, $parser ) = @_; @@ -447,6 +441,54 @@ sub _aggregate_single { return; } +=head3 C + + $harness->aggregate_tests( $aggregate, @tests ); + +Run the named tests and display a summary of result. Tests will be run +in the order found. + +Test results will be added to the supplied L. +C may be called multiple times to run several sets of +tests. Multiple C instances may be used to pass results +to a single aggregator so that different parts of a complex test suite +may be run using different C settings. This is useful, for +example, in the case where some tests should run in parallel but others +are unsuitable for parallel execution. + + my $formatter = TAP::Formatter::Console->new; + my $ser_harness = TAP::Harness->new( { formatter => $formatter } ); + my $par_harness = TAP::Harness->new( { formatter => $formatter, + jobs => 9 } ); + my $aggregator = TAP::Parser::Aggregator->new; + + $aggregator->start(); + $ser_harness->aggregate_tests( $aggregator, @ser_tests ); + $par_harness->aggregate_tests( $aggregator, @par_tests ); + $aggregator->stop(); + $formatter->summary( $aggregator ); + +Note that for simpler testing requirements it will often be possible to +replace the above code with a single call to C. + +Each elements of the @tests array is either + +=over + +=item * the file name of a test script to run + +=item * a reference to a [ file name, display name ] + +=back + +When you supply a separate display name it becomes possible to run a +test more than once; the display name is effectively the alias by which +the test is known inside the harness. The harness doesn't care if it +runs the same script more than once along as each invocation uses a +different name. + +=cut + sub aggregate_tests { my ( $self, $aggregate, @tests ) = @_; @@ -456,7 +498,6 @@ sub aggregate_tests { # Formatter gets only names $self->formatter->prepare( map { $_->[1] } @expanded ); - $aggregate->start; if ( $self->jobs > 1 ) { if ( $self->fork ) { @@ -470,8 +511,6 @@ sub aggregate_tests { $self->_aggregate_single( $aggregate, @expanded ); } - $aggregate->stop; - return; } diff --git a/lib/TAP/Parser.pm b/lib/TAP/Parser.pm index 7bfe557..211bf21 100644 --- a/lib/TAP/Parser.pm +++ b/lib/TAP/Parser.pm @@ -19,11 +19,11 @@ TAP::Parser - Parse L output =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; my $DEFAULT_TAP_VERSION = 12; my $MAX_TAP_VERSION = 13; @@ -1542,7 +1542,7 @@ patch against bleed by via anonymous checkout of the latest version: =head1 COPYRIGHT & LICENSE -Copyright 2006-2007 Curtis "Ovid" Poe, all rights reserved. +Copyright 2006-2008 Curtis "Ovid" Poe, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/TAP/Parser/Aggregator.pm b/lib/TAP/Parser/Aggregator.pm index 881b5f2..ed6846f 100644 --- a/lib/TAP/Parser/Aggregator.pm +++ b/lib/TAP/Parser/Aggregator.pm @@ -10,11 +10,11 @@ TAP::Parser::Aggregator - Aggregate TAP::Parser results =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 SYNOPSIS diff --git a/lib/TAP/Parser/Grammar.pm b/lib/TAP/Parser/Grammar.pm index 7e6e449..d82b455 100644 --- a/lib/TAP/Parser/Grammar.pm +++ b/lib/TAP/Parser/Grammar.pm @@ -12,11 +12,11 @@ TAP::Parser::Grammar - A grammar for the Test Anything Protocol. =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Iterator.pm b/lib/TAP/Parser/Iterator.pm index 8b65f06..7842d9c 100644 --- a/lib/TAP/Parser/Iterator.pm +++ b/lib/TAP/Parser/Iterator.pm @@ -13,11 +13,11 @@ TAP::Parser::Iterator - Internal TAP::Parser Iterator =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 SYNOPSIS diff --git a/lib/TAP/Parser/Iterator/Array.pm b/lib/TAP/Parser/Iterator/Array.pm index 900c665..5979943 100644 --- a/lib/TAP/Parser/Iterator/Array.pm +++ b/lib/TAP/Parser/Iterator/Array.pm @@ -11,11 +11,11 @@ TAP::Parser::Iterator::Array - Internal TAP::Parser Iterator =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 SYNOPSIS diff --git a/lib/TAP/Parser/Iterator/Process.pm b/lib/TAP/Parser/Iterator/Process.pm index be04808..985aaf1 100644 --- a/lib/TAP/Parser/Iterator/Process.pm +++ b/lib/TAP/Parser/Iterator/Process.pm @@ -19,11 +19,11 @@ TAP::Parser::Iterator::Process - Internal TAP::Parser Iterator =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 SYNOPSIS diff --git a/lib/TAP/Parser/Iterator/Stream.pm b/lib/TAP/Parser/Iterator/Stream.pm index f3b60bf..73ad147 100644 --- a/lib/TAP/Parser/Iterator/Stream.pm +++ b/lib/TAP/Parser/Iterator/Stream.pm @@ -11,11 +11,11 @@ TAP::Parser::Iterator::Stream - Internal TAP::Parser Iterator =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 SYNOPSIS diff --git a/lib/TAP/Parser/Multiplexer.pm b/lib/TAP/Parser/Multiplexer.pm index 24575ff..e9ce60b 100644 --- a/lib/TAP/Parser/Multiplexer.pm +++ b/lib/TAP/Parser/Multiplexer.pm @@ -14,11 +14,11 @@ TAP::Parser::Multiplexer - Multiplex multiple TAP::Parsers =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 SYNOPSIS diff --git a/lib/TAP/Parser/Result.pm b/lib/TAP/Parser/Result.pm index 371057d..fa5f0a5 100644 --- a/lib/TAP/Parser/Result.pm +++ b/lib/TAP/Parser/Result.pm @@ -27,11 +27,11 @@ TAP::Parser::Result - TAP::Parser output =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head2 DESCRIPTION diff --git a/lib/TAP/Parser/Result/Bailout.pm b/lib/TAP/Parser/Result/Bailout.pm index 4a21149..d7ae9f1 100644 --- a/lib/TAP/Parser/Result/Bailout.pm +++ b/lib/TAP/Parser/Result/Bailout.pm @@ -12,11 +12,11 @@ TAP::Parser::Result::Bailout - Bailout result token. =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Result/Comment.pm b/lib/TAP/Parser/Result/Comment.pm index 9d5f80e..607daf7 100644 --- a/lib/TAP/Parser/Result/Comment.pm +++ b/lib/TAP/Parser/Result/Comment.pm @@ -12,11 +12,11 @@ TAP::Parser::Result::Comment - Comment result token. =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Result/Plan.pm b/lib/TAP/Parser/Result/Plan.pm index a245be2..ad7f315 100644 --- a/lib/TAP/Parser/Result/Plan.pm +++ b/lib/TAP/Parser/Result/Plan.pm @@ -12,11 +12,11 @@ TAP::Parser::Result::Plan - Plan result token. =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Result/Test.pm b/lib/TAP/Parser/Result/Test.pm index d08cacf..e0cee7c 100644 --- a/lib/TAP/Parser/Result/Test.pm +++ b/lib/TAP/Parser/Result/Test.pm @@ -14,11 +14,11 @@ TAP::Parser::Result::Test - Test result token. =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Result/Unknown.pm b/lib/TAP/Parser/Result/Unknown.pm index 079ba59..94ab7f8 100644 --- a/lib/TAP/Parser/Result/Unknown.pm +++ b/lib/TAP/Parser/Result/Unknown.pm @@ -14,11 +14,11 @@ TAP::Parser::Result::Unknown - Unknown result token. =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Result/Version.pm b/lib/TAP/Parser/Result/Version.pm index f52bfa9..f192f8a 100644 --- a/lib/TAP/Parser/Result/Version.pm +++ b/lib/TAP/Parser/Result/Version.pm @@ -12,11 +12,11 @@ TAP::Parser::Result::Version - TAP version result token. =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Result/YAML.pm b/lib/TAP/Parser/Result/YAML.pm index 4db3b27..b3a1ce5 100644 --- a/lib/TAP/Parser/Result/YAML.pm +++ b/lib/TAP/Parser/Result/YAML.pm @@ -12,11 +12,11 @@ TAP::Parser::Result::YAML - YAML result token. =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Source.pm b/lib/TAP/Parser/Source.pm index c645efe..517b00f 100644 --- a/lib/TAP/Parser/Source.pm +++ b/lib/TAP/Parser/Source.pm @@ -14,11 +14,11 @@ TAP::Parser::Source - Stream output from some source =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Source/Perl.pm b/lib/TAP/Parser/Source/Perl.pm index 30d0c0a..4181550 100644 --- a/lib/TAP/Parser/Source/Perl.pm +++ b/lib/TAP/Parser/Source/Perl.pm @@ -16,11 +16,11 @@ TAP::Parser::Source::Perl - Stream Perl output =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/YAMLish/Reader.pm b/lib/TAP/Parser/YAMLish/Reader.pm index aaba1bb..2acc47f 100644 --- a/lib/TAP/Parser/YAMLish/Reader.pm +++ b/lib/TAP/Parser/YAMLish/Reader.pm @@ -4,7 +4,7 @@ use strict; use vars qw{$VERSION}; -$VERSION = '3.06'; +$VERSION = '3.07'; # TODO: # Handle blessed object syntax @@ -277,7 +277,7 @@ TAP::Parser::YAMLish::Reader - Read YAMLish data from iterator =head1 VERSION -Version 3.06 +Version 3.07 =head1 SYNOPSIS @@ -326,9 +326,9 @@ L =head1 COPYRIGHT -Copyright 2007 Andy Armstrong. +Copyright 2007-2008 Andy Armstrong. -Portions copyright 2006-2007 Adam Kennedy. +Portions copyright 2006-2008 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/TAP/Parser/YAMLish/Writer.pm b/lib/TAP/Parser/YAMLish/Writer.pm index 446114c..2d95b26 100644 --- a/lib/TAP/Parser/YAMLish/Writer.pm +++ b/lib/TAP/Parser/YAMLish/Writer.pm @@ -4,7 +4,7 @@ use strict; use vars qw{$VERSION}; -$VERSION = '3.06'; +$VERSION = '3.07'; my $ESCAPE_CHAR = qr{ [ \x00-\x1f \" ] }x; @@ -147,7 +147,7 @@ TAP::Parser::YAMLish::Writer - Write YAMLish data =head1 VERSION -Version 3.06 +Version 3.07 =head1 SYNOPSIS @@ -243,7 +243,7 @@ L =head1 COPYRIGHT -Copyright 2007 Andy Armstrong. +Copyright 2007-2008 Andy Armstrong. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Test/Harness.pm b/lib/Test/Harness.pm index 155279f..596883a 100644 --- a/lib/Test/Harness.pm +++ b/lib/Test/Harness.pm @@ -21,6 +21,7 @@ use vars qw( $Verbose $Switches $Debug $verbose $switches $debug $Columns + $Color $Directives $Timer $Strap @@ -40,11 +41,11 @@ Test::Harness - Run Perl standard test scripts with statistics =head1 VERSION -Version 3.06 +Version 3.07 =cut -$VERSION = '3.06'; +$VERSION = '3.07'; # Backwards compatibility for exportable variable names. *verbose = *Verbose; @@ -71,6 +72,7 @@ $Switches = '-w'; $Columns = $ENV{HARNESS_COLUMNS} || $ENV{COLUMNS} || 80; $Columns--; # Some shells have trouble with a full line of text. $Timer = $ENV{HARNESS_TIMER} || 0; +$Color = $ENV{HARNESS_COLOR} || 0; =head1 SYNOPSIS @@ -125,7 +127,7 @@ sub _aggregate { # Jiggery pokery doesn't appear to work on VMS - so disable it # pending investigation. - $harness->aggregate_tests( $aggregate, @tests ); + _aggregate_tests( $harness, $aggregate, @tests ); } else { my $path_sep = $Config{path_sep}; @@ -153,10 +155,18 @@ sub _aggregate { $ENV{PERL5LIB} = join( $path_sep, @extra_inc ); } - $harness->aggregate_tests( $aggregate, @tests ); + _aggregate_tests( $harness, $aggregate, @tests ); } } +sub _aggregate_tests { + my ( $harness, $aggregate, @tests ) = @_; + $aggregate->start(); + $harness->aggregate_tests( $aggregate, @tests ); + $aggregate->stop(); + +} + sub runtests { my @tests = @_; @@ -229,12 +239,16 @@ sub _new_harness { # Do things the old way on VMS... push @lib, _filtered_inc() if IS_VMS; + # If $Verbose isn't numeric default to 1. This helps core. + my $verbosity = ( $Verbose ? ( $Verbose !~ /\d/ ) ? 1 : $Verbose : 0 ); + my $args = { timer => $Timer, directives => $Directives, lib => \@lib, switches => \@switches, - verbosity => $Verbose, + color => $Color, + verbosity => $verbosity, }; if ( defined( my $env_opt = $ENV{HARNESS_OPTIONS} ) ) { @@ -245,6 +259,9 @@ sub _new_harness { elsif ( $opt eq 'f' ) { $args->{fork} = 1; } + elsif ( $opt eq 'c' ) { + $args->{color} = 1; + } else { die "Unknown HARNESS_OPTIONS item: $opt\n"; } @@ -563,7 +580,7 @@ L (on which this module is based) has this attribution: =head1 LICENCE AND COPYRIGHT -Copyright (c) 2007, Andy Armstrong C<< >>. All rights reserved. +Copyright (c) 2007-2008, Andy Armstrong C<< >>. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. diff --git a/lib/Test/Harness/Changes b/lib/Test/Harness/Changes index c1e1e5a..ff7eee0 100644 --- a/lib/Test/Harness/Changes +++ b/lib/Test/Harness/Changes @@ -1,12 +1,17 @@ Revision history for Test-Harness -3.06 +3.07 2008-01-13 + - prove now supports HARNESS_PERL_SWITCHES. + - restored TEST_VERBOSE to prove. + +3.06 2008-01-01 - Skip t/unicode.t if PERL_UNICODE set. Fixes #31731. Thanks Lukas. - App::Prove::State no longer complains about tests that are deleted. - --state=new and --state=old now consider the modification time of test scripts. + - Made test suite core-compatible. 3.05 2007-12-09 - Skip unicode.t if Encode unavailable