From: Jarkko Hietaniemi Date: Fri, 15 Aug 2003 04:58:34 +0000 (+0000) Subject: Upgrade to Test::Harness 2.30. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cf2ab31a162e9f8507b05df9dcd0911de1e1ef9b;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Test::Harness 2.30. p4raw-id: //depot/perl@20716 --- diff --git a/lib/Test/Harness.pm b/lib/Test/Harness.pm index cc1dd32..7fd48e6 100644 --- a/lib/Test/Harness.pm +++ b/lib/Test/Harness.pm @@ -1,5 +1,5 @@ # -*- Mode: cperl; cperl-indent-level: 4 -*- -# $Id: Harness.pm,v 1.52 2003/07/17 19:02:48 andy Exp $ +# $Id: Harness.pm,v 1.54 2003/08/15 01:05:00 andy Exp $ package Test::Harness; @@ -22,7 +22,7 @@ use vars qw($VERSION $Verbose $Switches $Have_Devel_Corestack $Curtest $Have_Devel_Corestack = 0; -$VERSION = '2.29'; +$VERSION = '2.30'; $ENV{HARNESS_ACTIVE} = 1; @@ -1096,17 +1096,17 @@ analysis. Either Tim Bunce or Andreas Koenig, we don't know. What we know for sure is, that it was inspired by Larry Wall's TEST script that came with perl distributions for ages. Numerous anonymous contributors -exist. Andreas Koenig held the torch for many years. +exist. Andreas Koenig held the torch for many years, and then +Michael G Schwern. -Current maintainer is Michael G Schwern Eschwern@pobox.comE +Current maintainer is Andy Lester C<< >>. =head1 LICENSE This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -See F - +See L =head1 TODO @@ -1115,6 +1115,8 @@ validation of tests. This will probably take the form of a version of runtests() which rather than printing its output returns raw data on the state of the tests. (Partially done in Test::Harness::Straps) +Document the format. + Fix HARNESS_COMPILE_TEST without breaking its core usage. Figure a way to report test names in the failure summary. @@ -1126,10 +1128,36 @@ Deal with VMS's "not \nok 4\n" mistake. Add option for coverage analysis. +Trap STDERR. + +Implement Straps total_results() + +Remember exit code + +Completely redo the print summary code. + +Implement Straps callbacks. (experimentally implemented) + +Straps->analyze_file() not taint clean, don't know if it can be + +Fix that damned VMS nit. + +HARNESS_TODOFAIL to display TODO failures + +Add a test for verbose. + +Change internal list of test results to a hash. + +Fix stats display when there's an overrun. + +Fix so perls with spaces in the filename work. + =for _private + Keeping whittling away at _run_all_tests() =for _private + Clean up how the summary is printed. Get rid of those damned formats. =head1 BUGS diff --git a/lib/Test/Harness/Changes b/lib/Test/Harness/Changes index 37e9e1f..ea124e2 100644 --- a/lib/Test/Harness/Changes +++ b/lib/Test/Harness/Changes @@ -1,5 +1,37 @@ Revision history for Perl extension Test::Harness +2.30 Thu Aug 14 20:04:00 CDT 2003 + No functional changes in this version. It's only to make some doc + tweaks, and bump up the version number in T:H:Straps. + + [DOCUMENTATION] + - Changed Schwern to Andy as the maintainer. + - Incorporated the TODO file into Harness.pm proper. + - Cleaned up formatting in Test::Harness::Straps. + +2.29 Wed Jul 17 14:08:00 CDT 2003 + - Released as 2.29. + +2.28_91 Sun Jul 13 00:10:00 CDT 2003 + [ENHANCEMENTS] + - Added support for HARNESS_OK_SLOW. This will make a significant + speedup for slower connections. + - Folded in some changes from bleadperl that spiff up the + failure reports. + + [INTERNALS] + - Added some isa_ok() checks to the tests. + - All Test::Harness* modules are used by use_ok() + - Fixed the prototype for the canonfailed() function, not that + it matters since it's never called without parens. + +2.28_90 Sat Jul 05 20:21:00 CDT 2003 + [ENHANCEMENTS] + - Now, when you run a test harnessed, the numbers don't fly by one + at a time, one update per second. This significantly speeds + up the run time for running thousands of tests. *COUGH* + Regexp::Common *COUGH* + 2.28 Thu Apr 24 14:39:00 CDT 2003 - No functional changes. diff --git a/lib/Test/Harness/Straps.pm b/lib/Test/Harness/Straps.pm index 294dafa..94fd363 100644 --- a/lib/Test/Harness/Straps.pm +++ b/lib/Test/Harness/Straps.pm @@ -1,12 +1,12 @@ # -*- Mode: cperl; cperl-indent-level: 4 -*- -# $Id: Straps.pm,v 1.17 2003/04/03 17:47:25 andy Exp $ +# $Id: Straps.pm,v 1.18 2003/08/15 01:29:23 andy Exp $ package Test::Harness::Straps; use strict; use vars qw($VERSION); use Config; -$VERSION = '0.141'; +$VERSION = '0.15'; use Test::Harness::Assert; use Test::Harness::Iterator; @@ -58,11 +58,9 @@ The interface is currently incomplete. I contact the author if you'd like a feature added or something change or just have comments. -=head2 Construction +=head1 Construction -=over 4 - -=item B +=head2 C my $strap = Test::Harness::Straps->new; @@ -80,9 +78,7 @@ sub new { return $self; } -=begin _private - -=item B<_init> +=head2 C<_init> $strap->_init; @@ -97,23 +93,18 @@ sub _init { $self->{_is_win32} = $^O eq 'Win32'; } -=end _private - -=back - -=head2 Analysis - -=over 4 +=head1 Analysis -=item B +=head2 C my %results = $strap->analyze($name, \@test_output); -Analyzes the output of a single test, assigning it the given $name for -use in the total report. Returns the %results of the test. See -L. +Analyzes the output of a single test, assigning it the given C<$name> +for use in the total report. Returns the C<%results> of the test. +See L. -@test_output should be the raw output from the test, including newlines. +C<@test_output> should be the raw output from the test, including +newlines. =cut @@ -231,7 +222,7 @@ sub _analyze_line { $self->{'next'} = $result{number} + 1 if $type eq 'test'; } -=item B +=head2 C my %results = $strap->analyze_fh($name, $test_filehandle); @@ -246,11 +237,11 @@ sub analyze_fh { $self->_analyze_iterator($name, $it); } -=item B +=head2 C my %results = $strap->analyze_file($test_file); -Like C, but it runs the given $test_file and parses it's +Like C, but it runs the given C<$test_file> and parses its results. It will also use that name for the total report. =cut @@ -308,9 +299,7 @@ else { } -=begin _private - -=item B<_switches> +=head2 C<_switches> my $switches = $self->_switches($file); @@ -344,12 +333,12 @@ sub _switches { } -=item B<_INC2PERL5LIB> +=head2 C<_INC2PERL5LIB> local $ENV{PERL5LIB} = $self->_INC2PERL5LIB; -Takes the current value of @INC and turns it into something suitable -for putting onto PERL5LIB. +Takes the current value of C<@INC> and turns it into something suitable +for putting onto C. =cut @@ -361,12 +350,12 @@ sub _INC2PERL5LIB { return join $Config{path_sep}, $self->_filtered_INC; } -=item B<_filtered_INC> +=head2 C<_filtered_INC> my @filtered_inc = $self->_filtered_INC; -Shortens @INC by removing redundant and unnecessary entries. -Necessary for OS's with limited command line lengths, like VMS. +Shortens C<@INC> by removing redundant and unnecessary entries. +Necessary for OSes with limited command line lengths, like VMS. =cut @@ -385,11 +374,11 @@ sub _filtered_INC { } -=item B<_restore_PERL5LIB> +=head2 C<_restore_PERL5LIB> $self->_restore_PERL5LIB; -This restores the original value of the PERL5LIB environment variable. +This restores the original value of the C environment variable. Necessary on VMS, otherwise a no-op. =cut @@ -404,26 +393,16 @@ sub _restore_PERL5LIB { } } - -=end _private - -=back - - -=begin _private - -=head2 Parsing +=head1 Parsing Methods for identifying what sort of line you're looking at. -=over 4 - -=item B<_is_comment> +=head2 C<_is_comment> my $is_comment = $strap->_is_comment($line, \$comment); Checks if the given line is a comment. If so, it will place it into -$comment (sans #). +C<$comment> (sans #). =cut @@ -439,14 +418,14 @@ sub _is_comment { } } -=item B<_is_header> +=head2 C<_is_header> my $is_header = $strap->_is_header($line); -Checks if the given line is a header (1..M) line. If so, it places -how many tests there will be in $strap->{max}, a list of which tests -are todo in $strap->{todo} and if the whole test was skipped -$strap->{skip_all} contains the reason. +Checks if the given line is a header (1..M) line. If so, it places how +many tests there will be in C<< $strap->{max} >>, a list of which tests +are todo in C<< $strap->{todo} >> and if the whole test was skipped +C<< $strap->{skip_all} >> contains the reason. =cut @@ -483,12 +462,12 @@ sub _is_header { } } -=item B<_is_test> +=head2 C<_is_test> my $is_test = $strap->_is_test($line, \%test); Checks if the $line is a test report (ie. 'ok/not ok'). Reports the -result back in %test which will contain: +result back in C<%test> which will contain: ok did it succeed? This is the literal 'ok' or 'not ok'. name name of the test (if any) @@ -498,7 +477,7 @@ result back in %test which will contain: reason why is it todo or skip? (if any) If will also catch lone 'not' lines, note it saw them -$strap->{saw_lone_not} and the line in $strap->{lone_not_line}. +C<< $strap->{saw_lone_not} >> and the line in C<< $strap->{lone_not_line} >>. =cut @@ -552,7 +531,7 @@ sub _is_test { } } -=item B<_is_bail_out> +=head2 C<_is_bail_out> my $is_bail_out = $strap->_is_bail_out($line, \$reason); @@ -573,12 +552,12 @@ sub _is_bail_out { } } -=item B<_reset_file_state> +=head2 C<_reset_file_state> $strap->_reset_file_state; -Resets things like $strap->{max}, $strap->{skip_all}, etc... so its -ready to parse the next file. +Resets things like C<< $strap->{max} >> , C<< $strap->{skip_all} >>, +etc. so it's ready to parse the next file. =cut @@ -595,14 +574,10 @@ sub _reset_file_state { $self->{'next'} = 1; } -=back - -=end _private - - -=head2 Results +=head1 Results -The %results returned from analyze() contain the following information: +The C<%results> returned from C contain the following +information: passing true if the whole test is considered a pass (or skipped), false if its a failure @@ -643,17 +618,13 @@ There is one final item, the details. Element 0 of the details is test #1. I tried it with element 1 being #1 and 0 being empty, this is less awkward. -=begin _private - -=over 4 - -=item B<_detailize> +=head2 C<_detailize> my %details = $strap->_detailize($pass, \%test); -Generates the details based on the last test line seen. $pass is true -if it was considered to be a passed test. %test is the results of the -test you're summarizing. +Generates the details based on the last test line seen. C<$pass> is +true if it was considered to be a passed test. C<%test> is the results +of the test you're summarizing. =cut @@ -677,17 +648,14 @@ sub _detailize { return %details; } -=back - -=end _private - =head1 EXAMPLES See F for an example of use. =head1 AUTHOR -Michael G Schwern Eschwern@pobox.comE +Michael G Schwern C<< >>, currently maintained by +Andy Lester C<< >>. =head1 SEE ALSO diff --git a/lib/Test/Harness/t/pod.t b/lib/Test/Harness/t/pod.t index ef38c05..6a299a6 100644 --- a/lib/Test/Harness/t/pod.t +++ b/lib/Test/Harness/t/pod.t @@ -15,12 +15,9 @@ eval "use Test::Pod 0.95"; if ($@) { plan skip_all => "Test::Pod v0.95 required for testing POD"; } else { - Test::Pod->import; my @files; my $blib = File::Spec->catfile(qw(blib lib)); find( sub {push @files, $File::Find::name if /\.p(l|m|od)$/}, $blib); plan tests => scalar @files; - foreach my $file (@files) { - pod_file_ok($file); - } + Test::Pod::pod_file_ok($_) foreach @files; }