FAQ
(I'm CCing Andy Lester, the maintainer of Test::Harness here, because I'd like
to consult with him)
On Monday 05 September 2005 12:42, Shlomi Fish wrote:
Hi all!

Does anyone know of a Test::Harness extension or replacement that can color
the final report line in green if all tests passed and in red otherwise?
search.cpan.org is no help, and couldn't find anything relevant by a brief
scanning of its POD page there (but not a thorough reading of it).

I'd like to be able to use it without requiring the module's user to
install it, just using it on my local configuration.
OK, here's what I've discovered so far:

1. Module::Build's "test" action has an hard-coded call to the Test::Harness
API. It "require"s the Test::Harness module specifically and then calls its
API functions.

2. The statement that prints the message "All tests successful" is found
within Test::Harness' _show_results function:

<<<<
sub _show_results {
my($tot, $failedtests) = @_;

my $pct;
my $bonusmsg = _bonusmsg($tot);

if (_all_ok($tot)) {
print "All tests successful$bonusmsg.\n"; <-----------
} elsif (!$tot->{tests}){
die "FAILED--no tests were run for some reason.\n";
} elsif (!$tot->{max}) {

>>>>

As one can see overriding it will require replacing the entire function.

3. Test::Harness seems to use procedural code and so its functions cannot be
easily overrided using @ISA and derived namespaces.

------------

Thus, it seems the best option if we want to make sure Test::Harness is
custmisable in this and other ways is to spin it off and create a better and
more customizable test harnessing module, with an incompatible interface.
Another option is to create an environment variable triggered option for this
and future features, but that would be Evil.

Mr. Lester, would you approve of a friendly spin-off of Test::Harness?

Regards,

Shlomi Fish

---------------------------------------------------------------------
Shlomi Fish shlomif@iglu.org.il
Homepage: http://www.shlomifish.org/

95% of the programmers consider 95% of the code they did not write, in the
bottom 5%.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 14 | next ›
Discussion Overview
groupqa @
categoriesperl
postedSep 5, '05 at 9:44a
activeSep 17, '05 at 7:11a
posts14
users9
websiteqa.perl.org

People

Translate

site design / logo © 2021 Grokbase