On Sat, Aug 13, 2005 at 10:33:45PM -0400, John E. Malmberg wrote:
> There does not seem to be a method of explicitly closing or flushing the
> output stream being written to by Test::Builder.
> 
> Any ideas on how to resolve this?

I can change the test to write to a tied filehandle or I can make sure the
new Test::Builder object which outputs to some_file is destroyed before I
read from some_file.  The later has the nice side effect of testing that
destroying a Test::Builder object closes any open filehandles.

Try the attached patch and let me know.


-- 
Michael G Schwern     [EMAIL PROTECTED]     http://www.pobox.com/~schwern
Don't try the paranormal until you know what's normal.
        -- "Lords and Ladies" by Terry Prachett
=== t/create.t
==================================================================
--- t/create.t  (revision 2525)
+++ t/create.t  (local)
@@ -16,22 +16,24 @@
 use Test::Builder;
 
 my $more_tb = Test::More->builder;
-my $new_tb  = Test::Builder->create;
-
-isa_ok $new_tb,  'Test::Builder';
 isa_ok $more_tb, 'Test::Builder';
 
-isnt $more_tb, $new_tb, 'Test::Builder->create makes a new object';
-
 is $more_tb, Test::More->builder, 'create does not interfere with ->builder';
 is $more_tb, Test::Builder->new,  '       does not interfere with ->new';
 
-$new_tb->output("some_file");
-END { 1 while unlink "some_file" }
+{
+    my $new_tb  = Test::Builder->create;
 
-$new_tb->plan(tests => 1);
-$new_tb->ok(1);
+    isa_ok $new_tb,  'Test::Builder';
+    isnt $more_tb, $new_tb, 'Test::Builder->create makes a new object';
 
+    $new_tb->output("some_file");
+    END { 1 while unlink "some_file" }
+
+    $new_tb->plan(tests => 1);
+    $new_tb->ok(1);
+}
+
 pass("Changing output() of new TB doesn't interfere with singleton");
 
 ok open FILE, "some_file";

Reply via email to