does anyone have thoughts as to how to assert the results of an external
process?

We've been using this:

sub assert_cmd
{
    my $self = shift();
    my($cmd,$expected,$expRet) = @_;

    if (!defined($expRet)) {
        $expRet = 0;
    }

    my $output = `$cmd`;
    my $retval = CheckRetVal($CHILD_ERROR);

    if (($retval != $expRet) ||
        (defined($expected) && ($output !~ m/$expected/))) {
        $self->fail(qq{$retval "$cmd" "$output"});
    }
    else 
    {
        debugprint("$cmd");
    }
    return $retval;
}

sub CheckRetVal 
{
        my($value) = @_;
        my($retval);

        if ($Config{osname} eq "MSWin32") 
        {
                # perl on win32 doesn't seem to return wait(2) value
                # so do nothing
                $retval = $value;
        }
        else 
        {
                $retval = $value >>8;
        }
        $retval;
}



Christian Lemburg wrote:
> 
> Hi all,
> 
> I uploaded a new file release (Test-Unit-0.14pre.tar.gz),
> intended for internal testing and corrections before
> release to CPAN.
> 
> Please have a look at it and tell me what to add/change
> (or add/change yourself, if you want).
> 
> I am hopeful that I have found a workaround for the
> problems that older Perls had (two tests using
> Test::Unit::Assertion::Boolean failed), without changing
> all the 'use base' stuff.  At least the tests run now on my
> 5.005_03 installation without the changed 'base' module.
> 
> Christian Lemburg
> 
> _______________________________________________
> Perlunit-devel mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/perlunit-devel

_______________________________________________
Perlunit-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/perlunit-devel

Reply via email to