develooper Front page | perl.perl5.porters | Postings from September 2001

[PATCH lib/Test/Simple.pm lib/Test/Utils.pm] fix test.deparse

Thread Next
From:
Michael G Schwern
Date:
September 25, 2001 14:44
Subject:
[PATCH lib/Test/Simple.pm lib/Test/Utils.pm] fix test.deparse
Message ID:
20010925174349.B19534@blackrider
I believe I've solved the 'make test.deparse' problem, and it's not
'use vars'.

make test.deparse runs each program as:

    ./perl -I../lib -MO=-qq,Deparse,-l

First off running O.pm with -qq on interferes with STDOUT pretty
rashly.  That causes Test::Simple to be unable to dup it, interfering
with it's compilation.

The second is that during the compilation of
lib/Test/Simple/t/simple.t (for example) the 1..3 leaks out at compile
time (even with O.pm in -qq mode), since it's done as part of the
'use'.

O.pm's -qq mode probably needs some more rethinking, but I can patch
up the tests by using $^C.  Basically, Test::Simple/More won't try to
print anything or dup anything if it's just being compiled.

This patch should allow "make test.deparse" to return to it's previous
value of working.


--- lib/Test/Utils.pm	2001/09/25 21:21:43	1.1
+++ lib/Test/Utils.pm	2001/09/25 21:21:54
@@ -17,6 +17,8 @@
 sub my_print (*@) {
     my($fh, @args) = @_;
 
+    return 1 if $^C;
+
     local $\;
     print $fh @args;
 }
--- lib/Test/Simple.pm	2001/09/25 20:41:23	1.1
+++ lib/Test/Simple.pm	2001/09/25 21:33:32
@@ -70,16 +70,17 @@
 }
 
 
-
-$| = 1;
-open(*TESTOUT, ">&STDOUT") or _whoa(1, "Can't dup STDOUT!");
-open(*TESTERR, ">&STDOUT") or _whoa(1, "Can't dup STDOUT!");
-{
-    my $orig_fh = select TESTOUT;
+unless( $^C ) {    
     $| = 1;
-    select TESTERR;
-    $| = 1;
-    select $orig_fh;
+    open(*TESTOUT, ">&STDOUT") or _whoa(1, "Can't dup STDOUT!");
+    open(*TESTERR, ">&STDOUT") or _whoa(1, "Can't dup STDOUT!");
+    {
+        my $orig_fh = select TESTOUT;
+        $| = 1;
+        select TESTERR;
+        $| = 1;
+        select $orig_fh;
+    }
 }
 
 =head1 NAME



-- 

Michael G. Schwern   <schwern@pobox.com>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <perl-qa@perl.org>	     Kwalitee Is Job One
BOFH excuse #72:

Satan did it

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About