On Tue, Jan 27, 2004 at 12:49:25PM -0500, Uri Guttman wrote:
> Test::* can't handle output from forked children

Yes, the problem is the child process can't inform the parent of how many
tests it ran.  The simplest way around this problem is to have the 
parent account for any tests run in the child by incrementing the test
counter manually.

        use Test::More tests => 4;
        my $builder = Test::More->builder;

        pass 'some test in the parent';
        if( fork ) {
                # account for the one test run in the child.
                $builder->current_test($builder->current_test + 1);
                pass 'another test in the parent';
        }
        else {
                pass 'a test in the child';
                exit;
        }

        pass 'one last test in the parent';

It can also sometimes make things less complicated if you shut off test 
numbers ($builder->use_numbers(0)).


-- 
Michael G Schwern        [EMAIL PROTECTED]  http://www.pobox.com/~schwern/
If it's stupid, but it works, it isn't stupid.

Reply via email to