Skip Menu |

This queue is for tickets about the HTML-Stream CPAN distribution.

Report information
The Basics
Id: 38183
Status: resolved
Estimated: 10 min
Worked: 40 min
Priority: 0/
Queue: HTML-Stream

People
Owner: DStaal [...] usa.net
Requestors: he [...] NetBSD.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in:
  • 1.58
  • 1.59
Fixed in: 1.60



Subject: Test::Output-needing tests
Date: Tue, 05 Aug 2008 13:17:39 +0200 (CEST)
To: bug-HTML-Stream [...] rt.cpan.org
From: Havard Eidnes <he [...] NetBSD.org>
Hi, while updating HTML-Stream for the NetBSD pkgsrc collection, I found that the tests using Test::Output were all being skipped, despite me just having installed that package. This diff appears to fix the problem: --- t/02-OO_Tests.t.orig 2008-08-05 12:28:40.000000000 +0200 +++ t/02-OO_Tests.t @@ -43,7 +43,7 @@ is_deeply (\@tags, \@historic_tags, "Tag # Skip tests if we can't run them. SKIP : { skip 'Test::Output is needed for OO tests to run.', 16 - unless eval { require 'Test::Output' }; + unless ! eval { use Test::Output }; # Check that some of these tags actually work as expected... stdout_is( sub { $HTML->ABBR }, "<ABBR>" ); This diff was made after doing a system call trace and finding that it was searching for the file Test::Output.pm in various directories, instead of Test/Output.pm the same places. Best regards, - Havard
Your patch introduces another problem: 'use' is evaluated at compile-time, not run-time, so the code would die entirely if Test::Output isn't installed. Unfortunately, Test::More doc's example doesn't seem to work correctly in all cases either. This will need more work.
Subject: Re: [rt.cpan.org #38183] Test::Output-needing tests
Date: Wed, 06 Aug 2008 11:38:32 +0200 (CEST)
To: bug-HTML-Stream [...] rt.cpan.org
From: Havard Eidnes <he [...] NetBSD.org>
Show quoted text
> Your patch introduces another problem: 'use' is evaluated at > compile-time, not run-time, so the code would die entirely if > Test::Output isn't installed.
You're right. I didn't test it without Test::Output installed. Show quoted text
> Unfortunately, Test::More doc's example doesn't seem to work > correctly in all cases either. > > This will need more work.
Yep. I found another and hopefully more acceptable patch which makes it work. It consists of dropping the single quotes around the module name in the require. This exposes a difference between 'use' and 'require'; the former imports the exported names into the local name space, the latter doesn't, so a manual import is needed. New diff below. Best regards, - HÃ¥vard
$NetBSD$ --- t/02-OO_Tests.t.orig 2008-06-01 19:19:04.000000000 +0200 +++ t/02-OO_Tests.t @@ -43,7 +43,8 @@ is_deeply (\@tags, \@historic_tags, "Tag # Skip tests if we can't run them. SKIP : { skip 'Test::Output is needed for OO tests to run.', 16 - unless eval { require 'Test::Output' }; + unless eval { require Test::Output }; + Test::Output->import(); # Check that some of these tags actually work as expected... stdout_is( sub { $HTML->ABBR }, "<ABBR>" ); @@ -70,4 +71,4 @@ SKIP : { stdout_is( sub { $HTML->nl(0) }, "" ); stdout_is( sub { $HTML->nl(-1) }, "" ); stdout_is( sub { $HTML->nl("a") }, "" ); -} \ No newline at end of file +}
Fixed in 1.60. Thanks for the help. I was forgetting about the 'Test::Output->import();' line. (What comes of not using Perl for ages...)