From: Andy Armstrong Date: Thu, 20 Dec 2007 17:49:07 +0000 (+0000) Subject: bring Test::Harness up to 3.06 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=69f36734c100b00aa1a0212b12ebd8485f366fef;p=p5sagit%2Fp5-mst-13.2.git bring Test::Harness up to 3.06 Message-Id: <5C57804B-6F71-4875-AEB6-C449F893E001@hexten.net> Date: Thu, 20 Dec 2007 17:49:07 +0000 p4raw-id: //depot/perl@32673 --- diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 5661297..f20e2ba 100644 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -14,7 +14,7 @@ package Maintainers; 'abigail' => 'Abigail ', 'ams' => 'Abhijit Menon-Sen ', 'andk' => 'Andreas J. Koenig ', - 'andya' => 'Andy Armstrong ', + 'andya' => 'Andy Armstrong ', 'arandal' => 'Allison Randal ', 'audreyt' => 'Audrey Tang ', 'avar' => 'Ævar Arnfjörð Bjarmason ', diff --git a/lib/App/Prove.pm b/lib/App/Prove.pm index 592f92b..828aa14 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION diff --git a/lib/App/Prove/State.pm b/lib/App/Prove/State.pm index fc4f035..c470c9e 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION @@ -178,20 +178,10 @@ sub apply_switch { $self->_select( order => sub { $_->{elapsed} } ); }, new => sub { - $self->_select( - order => sub { - ( $_->{total_failures} || 0 ) - + ( $_->{total_passes} || 0 ); - } - ); + $self->_select( order => sub { -$_->{mtime} } ); }, old => sub { - $self->_select( - order => sub { - -( ( $_->{total_failures} || 0 ) - + ( $_->{total_passes} || 0 ) ); - } - ); + $self->_select( order => sub { $_->{mtime} } ); }, save => sub { $self->{should_save}++; @@ -259,6 +249,7 @@ sub _query_clause { # Select for my $test ( sort keys %$tests ) { + next unless -f $test; local $_ = $tests->{$test}; push @got, $test if $where->(); } @@ -296,7 +287,7 @@ sub _get_raw_tests { } push @tests, - sort -d $arg + sort -d $arg ? $recurse ? $self->_expand_dir_recursive($arg) : glob( File::Spec->catfile( $arg, '*.t' ) ) @@ -405,9 +396,22 @@ sub load { # $writer->write( $self->{tests} || {}, \*FH ); close FH; $self->_regen_seq; + $self->_prune_and_stamp; $self->{_}->{generation}++; } +sub _prune_and_stamp { + my $self = shift; + for my $name ( keys %{ $self->{_}->{tests} || {} } ) { + if ( my @stat = stat $name ) { + $self->{_}->{tests}->{$name}->{mtime} = $stat[9]; + } + else { + delete $self->{_}->{tests}->{$name}; + } + } +} + sub _regen_seq { my $self = shift; for my $rec ( values %{ $self->{_}->{tests} || {} } ) { diff --git a/lib/TAP/Base.pm b/lib/TAP/Base.pm index 3985f7b..9919095 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; my $GOT_TIME_HIRES; diff --git a/lib/TAP/Formatter/Color.pm b/lib/TAP/Formatter/Color.pm index 7529da5..063fb07 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION diff --git a/lib/TAP/Formatter/Console.pm b/lib/TAP/Formatter/Console.pm index f239ec9..9e79d9a 100644 --- a/lib/TAP/Formatter/Console.pm +++ b/lib/TAP/Formatter/Console.pm @@ -20,7 +20,7 @@ BEGIN { errors => sub { shift; shift }, color => sub { shift; shift }, jobs => sub { shift; shift }, - stdout => sub { + stdout => sub { my ( $self, $ref ) = @_; $self->_croak("option 'stdout' needs a filehandle") unless ( ref $ref || '' ) eq 'GLOB' @@ -52,11 +52,11 @@ TAP::Formatter::Console - Harness output delegate for default console output =head1 VERSION -Version 3.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION @@ -312,8 +312,9 @@ sub summary { $self->_printed_summary_header(0); my ($parser) = $aggregate->parsers($test); $self->_output_summary_failure( - 'failed', " Failed test number(s): ", - $test, $parser + 'failed', + [ ' Failed test: ', ' Failed tests: ' ], + $test, $parser ); $self->_output_summary_failure( 'todo_passed', @@ -363,10 +364,12 @@ sub _output_summary_failure { # ugly hack. Must rethink this :( my $output = $method eq 'failed' ? '_failure_output' : '_output'; - if ( $parser->$method() ) { + if ( my @r = $parser->$method() ) { $self->_summary_test_header( $test, $parser ); - $self->$output($name); - my @results = $self->_balanced_range( 40, $parser->$method() ); + my ( $singular, $plural ) + = 'ARRAY' eq ref $name ? @$name : ( $name, $name ); + $self->$output( @r == 1 ? $singular : $plural ); + my @results = $self->_balanced_range( 40, @r ); $self->$output( sprintf "%s\n" => shift @results ); my $spaces = ' ' x 16; while (@results) { diff --git a/lib/TAP/Formatter/Console/ParallelSession.pm b/lib/TAP/Formatter/Console/ParallelSession.pm index b4caac4..96ca2cf 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION diff --git a/lib/TAP/Formatter/Console/Session.pm b/lib/TAP/Formatter/Console/Session.pm index 5490704..eb2cf50 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION diff --git a/lib/TAP/Harness.pm b/lib/TAP/Harness.pm index b792306..9dcd92c 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; $ENV{HARNESS_ACTIVE} = 1; $ENV{HARNESS_VERSION} = $VERSION; @@ -431,7 +431,13 @@ sub _aggregate_single { while ( defined( my $result = $parser->next ) ) { $session->result($result); - exit 1 if $result->is_bailout; + if ( $result->is_bailout ) { + + # Keep reading until input is exhausted in the hope + # of allowing any pending diagnostics to show up. + 1 while $parser->next; + exit 1; + } } $self->finish_parser( $parser, $session ); diff --git a/lib/TAP/Parser.pm b/lib/TAP/Parser.pm index 74bb137..7bfe557 100644 --- a/lib/TAP/Parser.pm +++ b/lib/TAP/Parser.pm @@ -19,11 +19,11 @@ TAP::Parser - Parse L output =head1 VERSION -Version 3.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; my $DEFAULT_TAP_VERSION = 12; my $MAX_TAP_VERSION = 13; @@ -865,7 +865,8 @@ failed, any TODO tests unexpectedly succeeded, or any parse errors occurred. sub has_problems { my $self = shift; - return $self->failed + return + $self->failed || $self->parse_errors || $self->wait || $self->exit; diff --git a/lib/TAP/Parser/Aggregator.pm b/lib/TAP/Parser/Aggregator.pm index 24e1638..881b5f2 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 SYNOPSIS @@ -249,7 +249,8 @@ Return true if all the tests passed and no parse errors were detected. sub all_passed { my $self = shift; - return $self->total + return + $self->total && $self->total == $self->passed && !$self->has_errors; } @@ -370,7 +371,8 @@ Returns true if I of the parsers failed. This includes: sub has_errors { my $self = shift; - return $self->failed + return + $self->failed || $self->parse_errors || $self->exit || $self->wait; diff --git a/lib/TAP/Parser/Grammar.pm b/lib/TAP/Parser/Grammar.pm index f516645..7e6e449 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Iterator.pm b/lib/TAP/Parser/Iterator.pm index 2eece34..8b65f06 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 SYNOPSIS diff --git a/lib/TAP/Parser/Iterator/Array.pm b/lib/TAP/Parser/Iterator/Array.pm index 175c4f2..900c665 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 SYNOPSIS diff --git a/lib/TAP/Parser/Iterator/Process.pm b/lib/TAP/Parser/Iterator/Process.pm index 3f89c84..be04808 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 SYNOPSIS diff --git a/lib/TAP/Parser/Iterator/Stream.pm b/lib/TAP/Parser/Iterator/Stream.pm index c745471..f3b60bf 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 SYNOPSIS diff --git a/lib/TAP/Parser/Multiplexer.pm b/lib/TAP/Parser/Multiplexer.pm index ee86bd5..24575ff 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 SYNOPSIS diff --git a/lib/TAP/Parser/Result.pm b/lib/TAP/Parser/Result.pm index 527ac11..371057d 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head2 DESCRIPTION diff --git a/lib/TAP/Parser/Result/Bailout.pm b/lib/TAP/Parser/Result/Bailout.pm index 2583a38..4a21149 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Result/Comment.pm b/lib/TAP/Parser/Result/Comment.pm index 01699db..9d5f80e 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Result/Plan.pm b/lib/TAP/Parser/Result/Plan.pm index 85735c3..a245be2 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Result/Test.pm b/lib/TAP/Parser/Result/Test.pm index 50326f0..d08cacf 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Result/Unknown.pm b/lib/TAP/Parser/Result/Unknown.pm index bfef1d6..079ba59 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Result/Version.pm b/lib/TAP/Parser/Result/Version.pm index f646fe2..f52bfa9 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Result/YAML.pm b/lib/TAP/Parser/Result/YAML.pm index 9e2c955..4db3b27 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Source.pm b/lib/TAP/Parser/Source.pm index 747b483..c645efe 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION diff --git a/lib/TAP/Parser/Source/Perl.pm b/lib/TAP/Parser/Source/Perl.pm index 72c3a39..30d0c0a 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.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; =head1 DESCRIPTION @@ -272,7 +272,7 @@ sub _switches { sub _get_perl { my $proto = shift; - return $ENV{HARNESS_PERL} if defined $ENV{HARNESS_PERL}; + return $ENV{HARNESS_PERL} if defined $ENV{HARNESS_PERL}; return Win32::GetShortPathName($^X) if IS_WIN32; return $^X; } diff --git a/lib/TAP/Parser/YAMLish/Reader.pm b/lib/TAP/Parser/YAMLish/Reader.pm index d041ca6..aaba1bb 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.05'; +$VERSION = '3.06'; # TODO: # Handle blessed object syntax @@ -277,7 +277,7 @@ TAP::Parser::YAMLish::Reader - Read YAMLish data from iterator =head1 VERSION -Version 3.05 +Version 3.06 =head1 SYNOPSIS diff --git a/lib/TAP/Parser/YAMLish/Writer.pm b/lib/TAP/Parser/YAMLish/Writer.pm index 4d2ed01..446114c 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.05'; +$VERSION = '3.06'; my $ESCAPE_CHAR = qr{ [ \x00-\x1f \" ] }x; @@ -147,7 +147,7 @@ TAP::Parser::YAMLish::Writer - Write YAMLish data =head1 VERSION -Version 3.05 +Version 3.06 =head1 SYNOPSIS diff --git a/lib/Test/Harness.pm b/lib/Test/Harness.pm index b355362..155279f 100644 --- a/lib/Test/Harness.pm +++ b/lib/Test/Harness.pm @@ -40,11 +40,11 @@ Test::Harness - Run Perl standard test scripts with statistics =head1 VERSION -Version 3.05 +Version 3.06 =cut -$VERSION = '3.05'; +$VERSION = '3.06'; # Backwards compatibility for exportable variable names. *verbose = *Verbose; diff --git a/lib/Test/Harness/Changes b/lib/Test/Harness/Changes index e397b88..c1e1e5a 100644 --- a/lib/Test/Harness/Changes +++ b/lib/Test/Harness/Changes @@ -1,5 +1,13 @@ Revision history for Test-Harness +3.06 + - 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. + 3.05 2007-12-09 - Skip unicode.t if Encode unavailable - Support for .proverc files. diff --git a/lib/Test/Harness/bin/prove b/lib/Test/Harness/bin/prove index ec58d7a..0888ac9 100644 --- a/lib/Test/Harness/bin/prove +++ b/lib/Test/Harness/bin/prove @@ -164,7 +164,7 @@ possible, for example, to recreate the ordering of a shuffled test. Run only the tests that failed on the last run. # Run all tests -e $ prove -b --state=save + $ prove -b --state=save # Run failures $ prove -b --state=failed diff --git a/lib/Test/Harness/t/harness.t b/lib/Test/Harness/t/harness.t index 4da18fc..a073bd6 100644 --- a/lib/Test/Harness/t/harness.t +++ b/lib/Test/Harness/t/harness.t @@ -286,7 +286,7 @@ foreach my $test_args ( get_arg_sets() ) { 't/source_tests/harness_failure (Wstat: 0 Tests: 2 Failed: 1)', '[[reset]]', '[[red]]', - 'Failed test number(s):', + 'Failed test:', '[[reset]]', '[[red]]', '2', @@ -309,7 +309,7 @@ foreach my $test_args ( get_arg_sets() ) { 'Test Summary Report', '-------------------', 't/source_tests/harness_failure (Wstat: 0 Tests: 2 Failed: 1)', - 'Failed test number(s):', + 'Failed test:', '2', ); @@ -330,7 +330,7 @@ foreach my $test_args ( get_arg_sets() ) { 'Test Summary Report', '-------------------', 't/source_tests/harness_failure (Wstat: 0 Tests: 2 Failed: 1)', - 'Failed test number(s):', + 'Failed test:', '2', ); @@ -434,7 +434,7 @@ foreach my $test_args ( get_arg_sets() ) { 't/source_tests/harness_badtap (Wstat: 0 Tests: 2 Failed: 1)', '[[reset]]', '[[red]]', - 'Failed test number(s):', + 'Failed test:', '[[reset]]', '[[red]]', '2', @@ -469,7 +469,7 @@ foreach my $test_args ( get_arg_sets() ) { 'Test Summary Report', '-------------------', 't/source_tests/harness_failure (Wstat: 0 Tests: 2 Failed: 1)', - 'Failed test number(s):', + 'Failed test:', '2', ); diff --git a/lib/Test/Harness/t/nofork-mux.t b/lib/Test/Harness/t/nofork-mux.t index 1ab27b1..23a0746 100644 --- a/lib/Test/Harness/t/nofork-mux.t +++ b/lib/Test/Harness/t/nofork-mux.t @@ -1,17 +1,17 @@ #!/usr/bin/perl -w - BEGIN { - if( $ENV{PERL_CORE} ) { + if ( $ENV{PERL_CORE} ) { chdir 't'; - @INC = ('../lib', 'lib'); + @INC = ( '../lib', 'lib' ); } else { - use lib 't/lib'; + use lib 't/lib'; } } use strict; use NoFork; -require ($ENV{PERL_CORE} && '../lib/Test/Harness/') . 't/multiplexer.t'; +require( + ( $ENV{PERL_CORE} ? '../lib/Test/Harness/' : '' ) . 't/multiplexer.t' ); diff --git a/lib/Test/Harness/t/regression.t b/lib/Test/Harness/t/regression.t index 46fc5e3..80902df 100644 --- a/lib/Test/Harness/t/regression.t +++ b/lib/Test/Harness/t/regression.t @@ -2357,45 +2357,44 @@ my %samples = ( wait => 0, version => 12, }, - - # switches => { - # results => [ - # { is_plan => TRUE, - # passed => TRUE, - # is_ok => TRUE, - # raw => '1..1', - # tests_planned => 1, - # }, - # { actual_passed => TRUE, - # is_actual_ok => TRUE, - # passed => TRUE, - # is_ok => TRUE, - # is_test => TRUE, - # has_skip => FALSE, - # has_todo => FALSE, - # number => 1, - # description => "", - # explanation => '', - # }, - # ], - # __ARGS__ => { switches => ['-Mstrict'] }, - # 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 => TRUE, - # parse_errors => [], - # 'exit' => 0, - # wait => 0, - # version => 12, - # }, + switches => { + results => [ + { is_plan => TRUE, + passed => TRUE, + is_ok => TRUE, + raw => '1..1', + tests_planned => 1, + }, + { actual_passed => TRUE, + is_actual_ok => TRUE, + passed => TRUE, + is_ok => TRUE, + is_test => TRUE, + has_skip => FALSE, + has_todo => FALSE, + number => 1, + description => "", + explanation => '', + }, + ], + __ARGS__ => { switches => ['-Mstrict'] }, + 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 => TRUE, + parse_errors => [], + 'exit' => 0, + wait => 0, + version => 12, + }, inc_taint => { results => [ { is_plan => TRUE, diff --git a/lib/Test/Harness/t/state.t b/lib/Test/Harness/t/state.t index 0963a7e..7ec4cfd 100644 --- a/lib/Test/Harness/t/state.t +++ b/lib/Test/Harness/t/state.t @@ -1,21 +1,25 @@ #!/usr/bin/perl -w -use strict; -use lib 't/lib'; +BEGIN { + if ( $ENV{PERL_CORE} ) { + chdir 't'; + @INC = '../lib'; + } + else { + unshift @INC, 't/lib'; + } +} +use strict; use Test::More; use App::Prove::State; -my @schedule = ( +sub mn { + my $pfx = $ENV{PERL_CORE} ? '../lib/Test/Harness/' : ''; + return map {"$pfx$_"} @_; +} - # last => sub { - # failed => sub { - # passed => sub { - # all => sub { - # todo => sub { - # hot => sub { - # save => sub { - # adrian => sub { +my @schedule = ( { options => 'all', get_tests_args => [], expect => [ @@ -127,23 +131,23 @@ my @schedule = ( { options => 'old', get_tests_args => [], expect => [ - 't/compat/env.t', - 't/compat/failure.t', + 't/source.t', 't/compat/inc_taint.t', 't/compat/version.t', - 't/source.t', 't/yamlish-writer.t', + 't/compat/failure.t', + 't/compat/env.t', ], }, { options => 'new', get_tests_args => [], expect => [ - 't/source.t', - 't/yamlish-writer.t', - 't/compat/inc_taint.t', - 't/compat/version.t', 't/compat/env.t', 't/compat/failure.t', + 't/yamlish-writer.t', + 't/compat/version.t', + 't/compat/inc_taint.t', + 't/source.t', ], }, ); @@ -162,11 +166,11 @@ for my $test (@schedule) { $options = [$options] unless 'ARRAY' eq ref $options; $state->apply_switch(@$options); - my @got = $state->get_tests( @{ $test->{get_tests_args} } ); - - unless ( is_deeply \@got, $test->{expect}, "$desc: order OK" ) { + my @got = $state->get_tests( @{ $test->{get_tests_args} } ); + my @expect = mn( @{ $test->{expect} } ); + unless ( is_deeply \@got, \@expect, "$desc: order OK" ) { use Data::Dumper; - diag( Dumper( { got => \@got, want => $test->{expect} } ) ); + diag( Dumper( { got => \@got, want => \@expect } ) ); } } @@ -174,7 +178,7 @@ sub get_state { return { 'generation' => '51', 'tests' => { - 't/compat/failure.t' => { + mn('t/compat/failure.t') => { 'last_result' => '0', 'last_run_time' => '1196371471.57738', 'last_pass_time' => '1196371471.57738', @@ -182,9 +186,10 @@ sub get_state { 'seq' => '1549', 'gen' => '51', 'elapsed' => 0.1230, - 'last_todo' => '1' + 'last_todo' => '1', + 'mtime' => 1196285623, }, - 't/yamlish-writer.t' => { + mn('t/yamlish-writer.t') => { 'last_result' => '0', 'last_run_time' => '1196371480.5761', 'last_pass_time' => '1196371480.5761', @@ -193,9 +198,10 @@ sub get_state { 'seq' => '1578', 'gen' => '49', 'elapsed' => 12.2983, - 'last_todo' => '0' + 'last_todo' => '0', + 'mtime' => 1196285400, }, - 't/compat/env.t' => { + mn('t/compat/env.t') => { 'last_result' => '0', 'last_run_time' => '1196371471.42967', 'last_pass_time' => '1196371471.42967', @@ -204,9 +210,10 @@ sub get_state { 'seq' => '1548', 'gen' => '52', 'elapsed' => 3.1290, - 'last_todo' => '0' + 'last_todo' => '0', + 'mtime' => 1196285739, }, - 't/compat/version.t' => { + mn('t/compat/version.t') => { 'last_result' => '2', 'last_run_time' => '1196371472.96476', 'last_pass_time' => '1196371472.96476', @@ -215,9 +222,10 @@ sub get_state { 'seq' => '1555', 'gen' => '51', 'elapsed' => 0.2363, - 'last_todo' => '4' + 'last_todo' => '4', + 'mtime' => 1196285239, }, - 't/compat/inc_taint.t' => { + mn('t/compat/inc_taint.t') => { 'last_result' => '3', 'last_run_time' => '1196371471.89682', 'last_pass_time' => '1196371471.89682', @@ -225,9 +233,10 @@ sub get_state { 'seq' => '1551', 'gen' => '51', 'elapsed' => 1.6938, - 'last_todo' => '0' + 'last_todo' => '0', + 'mtime' => 1196185639, }, - 't/source.t' => { + mn('t/source.t') => { 'last_result' => '0', 'last_run_time' => '1196371479.72508', 'last_pass_time' => '1196371479.72508', @@ -235,7 +244,8 @@ sub get_state { 'seq' => '1570', 'gen' => '51', 'elapsed' => 0.0143, - 'last_todo' => '0' + 'last_todo' => '0', + 'mtime' => 1186285639, }, } }; diff --git a/lib/Test/Harness/t/unicode.t b/lib/Test/Harness/t/unicode.t index 837a053..b5b767e 100644 --- a/lib/Test/Harness/t/unicode.t +++ b/lib/Test/Harness/t/unicode.t @@ -12,6 +12,9 @@ BEGIN { plan skip_all => "unicode on Perl < 5.8.0" unless $] > 5.008; + plan skip_all => "PERL_UNICODE set" + if $ENV{PERL_UNICODE}; + eval "use File::Temp"; plan skip_all => "File::Temp unavailable" if $@; diff --git a/t/lib/sample-tests/empty b/t/lib/sample-tests/empty index 71e8d95..66d42ad 100644 --- a/t/lib/sample-tests/empty +++ b/t/lib/sample-tests/empty @@ -1 +1,2 @@ __END__ +Used to exercise the "empty test" case.