# -*- 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;
$Have_Devel_Corestack = 0;
-$VERSION = '2.29';
+$VERSION = '2.30';
$ENV{HARNESS_ACTIVE} = 1;
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 E<lt>schwern@pobox.comE<gt>
+Current maintainer is Andy Lester C<< <andy@petdance.com> >>.
=head1 LICENSE
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
-See F<http://www.perl.com/perl/misc/Artistic.html>
-
+See L<http://www.perl.com/perl/misc/Artistic.html>
=head1 TODO
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.
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
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.
# -*- 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;
if you'd like a feature added or something change or just have
comments.
-=head2 Construction
+=head1 Construction
-=over 4
-
-=item B<new>
+=head2 C<new>
my $strap = Test::Harness::Straps->new;
return $self;
}
-=begin _private
-
-=item B<_init>
+=head2 C<_init>
$strap->_init;
$self->{_is_win32} = $^O eq 'Win32';
}
-=end _private
-
-=back
-
-=head2 Analysis
-
-=over 4
+=head1 Analysis
-=item B<analyze>
+=head2 C<analyze>
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<Results>.
+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<Results>.
-@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
$self->{'next'} = $result{number} + 1 if $type eq 'test';
}
-=item B<analyze_fh>
+=head2 C<analyze_fh>
my %results = $strap->analyze_fh($name, $test_filehandle);
$self->_analyze_iterator($name, $it);
}
-=item B<analyze_file>
+=head2 C<analyze_file>
my %results = $strap->analyze_file($test_file);
-Like C<analyze>, but it runs the given $test_file and parses it's
+Like C<analyze>, but it runs the given C<$test_file> and parses its
results. It will also use that name for the total report.
=cut
}
-=begin _private
-
-=item B<_switches>
+=head2 C<_switches>
my $switches = $self->_switches($file);
}
-=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<PERL5LIB>.
=cut
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
}
-=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<PERL5LIB> environment variable.
Necessary on VMS, otherwise a no-op.
=cut
}
}
-
-=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
}
}
-=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
}
}
-=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)
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
}
}
-=item B<_is_bail_out>
+=head2 C<_is_bail_out>
my $is_bail_out = $strap->_is_bail_out($line, \$reason);
}
}
-=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
$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<analyze()> contain the following
+information:
passing true if the whole test is considered a pass
(or skipped), false if its a failure
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
return %details;
}
-=back
-
-=end _private
-
=head1 EXAMPLES
See F<examples/mini_harness.plx> for an example of use.
=head1 AUTHOR
-Michael G Schwern E<lt>schwern@pobox.comE<gt>
+Michael G Schwern C<< <schwern@pobox.com> >>, currently maintained by
+Andy Lester C<< <andy@petdance.com> >>.
=head1 SEE ALSO