=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
'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},
$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 );
}
push @switches, '-w';
}
+ if ( defined( my $hps = $ENV{HARNESS_PERL_SWITCHES} ) ) {
+ push @switches, $hps;
+ }
+
return @switches ? \@switches : ();
}
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
my $GOT_TIME_HIRES;
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
$ENV{HARNESS_ACTIVE} = 1;
$ENV{HARNESS_VERSION} = $VERSION;
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<aggregate_tests>
-
- $harness->aggregate_tests( $aggregate, @tests );
-
-Tests will be run in the order found.
-
-=cut
-
sub _after_test {
my ( $self, $aggregate, $test, $parser ) = @_;
return;
}
+=head3 C<aggregate_tests>
+
+ $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<TAP::Parser::Aggregator>.
+C<aggregate_tests> may be called multiple times to run several sets of
+tests. Multiple C<Test::Harness> 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<TAP::Harness> 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<runtests>.
+
+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 ) = @_;
# Formatter gets only names
$self->formatter->prepare( map { $_->[1] } @expanded );
- $aggregate->start;
if ( $self->jobs > 1 ) {
if ( $self->fork ) {
$self->_aggregate_single( $aggregate, @expanded );
}
- $aggregate->stop;
-
return;
}
=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;
=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.
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 SYNOPSIS
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 SYNOPSIS
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 SYNOPSIS
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 SYNOPSIS
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 SYNOPSIS
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 SYNOPSIS
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head2 DESCRIPTION
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
=head1 DESCRIPTION
use vars qw{$VERSION};
-$VERSION = '3.06';
+$VERSION = '3.07';
# TODO:
# Handle blessed object syntax
=head1 VERSION
-Version 3.06
+Version 3.07
=head1 SYNOPSIS
=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.
use vars qw{$VERSION};
-$VERSION = '3.06';
+$VERSION = '3.07';
my $ESCAPE_CHAR = qr{ [ \x00-\x1f \" ] }x;
=head1 VERSION
-Version 3.06
+Version 3.07
=head1 SYNOPSIS
=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.
$Verbose $Switches $Debug
$verbose $switches $debug
$Columns
+ $Color
$Directives
$Timer
$Strap
=head1 VERSION
-Version 3.06
+Version 3.07
=cut
-$VERSION = '3.06';
+$VERSION = '3.07';
# Backwards compatibility for exportable variable names.
*verbose = *Verbose;
$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
# 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};
$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 = @_;
# 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} ) ) {
elsif ( $opt eq 'f' ) {
$args->{fork} = 1;
}
+ elsif ( $opt eq 'c' ) {
+ $args->{color} = 1;
+ }
else {
die "Unknown HARNESS_OPTIONS item: $opt\n";
}
=head1 LICENCE AND COPYRIGHT
-Copyright (c) 2007, Andy Armstrong C<< <andy@hexten.net> >>. All rights reserved.
+Copyright (c) 2007-2008, Andy Armstrong C<< <andy@hexten.net> >>. 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<perlartistic>.
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