Skip Menu |

This queue is for tickets about the TAP-Parser CPAN distribution.

Report information
The Basics
Id: 27125
Status: resolved
Worked: 10 min
Priority: 0/
Queue: TAP-Parser

People
Owner: andy [...] hexten.net
Requestors: DROLSKY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: 120-harness.t has failures if TAP::Harness::Color cannot load optional modules
I saw this on Windows, but I think it could happen on Linux too, if Term::ANSIColor wasn't installed. I've attached a patch that skips the color harness tests if we can't colorize.
Subject: th.patch
diff -ru ../TAP-Parser-0.51.orig/lib/TAP/Harness/Color.pm ./lib/TAP/Harness/Color.pm --- ../TAP-Parser-0.51.orig/lib/TAP/Harness/Color.pm 2007-05-14 11:39:45.000000000 -0500 +++ ./lib/TAP/Harness/Color.pm 2007-05-14 11:40:46.000000000 -0500 @@ -139,6 +139,21 @@ } return $class->SUPER::new(@_); } +############################################################################## + +=head3 C<CanColor> + + Test::Harness::Color->CanColor() + +Returns a boolean indicating whether or not this module can actually +generate colored output. This will be false if it could not load the +modules needed for the current platform. + +=cut + +sub CanColor { + return 0 ! $NO_COLOR; +} ############################################################################## diff -ru ../TAP-Parser-0.51.orig/t/120-harness.t ./t/120-harness.t --- ../TAP-Parser-0.51.orig/t/120-harness.t 2007-05-14 11:39:45.000000000 -0500 +++ ./t/120-harness.t 2007-05-14 11:34:48.000000000 -0500 @@ -4,7 +4,7 @@ use lib 'lib'; -use Test::More tests => 132; +use Test::More; # these tests cannot be run from the t/ directory due to checking for the # existence of execrc @@ -30,11 +30,17 @@ use TAP::Harness; use TAP::Harness::Color; +my @HARNESSES = 'TAP::Harness'; +push @HARNESSES, 'TAP::Harness::Color' + if TAP::Harness::Color->CanColor(); + +plan tests => TAP::Harness::Color->CanColor() ? 132 : 83; + # note that this test will always pass when run through 'prove' ok $ENV{HARNESS_ACTIVE}, 'HARNESS_ACTIVE env variable should be set'; ok $ENV{HARNESS_VERSION}, 'HARNESS_VERSION env variable should be set'; -foreach my $HARNESS (qw<TAP::Harness TAP::Harness::Color>) { +foreach my $HARNESS (@HARNESSES) { #foreach my $HARNESS ( () ) { # XXX can_ok $HARNESS, 'new'; Only in .: th.patch
From: andy at hexten dot net
On Mon May 14 12:42:02 2007, DROLSKY wrote: Show quoted text
> I saw this on Windows, but I think it could happen on Linux too, if > Term::ANSIColor wasn't installed. > > I've attached a patch that skips the color harness tests if we can't > colorize.
Thanks Dave - patch applied with a couple of minor modifications.
Oops - I /can/ mark it closed :)