Hi all!

These are some extra test files that I added to Test::Run, and possibly could 
be integrated into Test::Harness after some modification:

t/output.t:

<<<<<<<<<<<<<<<<
#!/usr/bin/perl -w

BEGIN {
    if( $ENV{PERL_CORE} ) {
        chdir 't';
        @INC = ('../lib', 'lib');
    }
    else {
        unshift @INC, 't/lib';
    }
}

use strict;

use Test::More tests => 2;

use Test::Run::Obj;

{
    open ALTOUT, ">", "altout.txt";
    open SAVEOUT, ">&STDOUT";
    open STDOUT, ">&ALTOUT";

    my $tester = Test::Run::Obj->new(
        test_files => ["t/sample-tests/simple"],
        );

    $tester->runtests();

    open STDOUT, ">&SAVEOUT";
    close(SAVEOUT);
    close(ALTOUT);

    my $text = do { local $/; local *I; open I, "<", "altout.txt"; <I>};

    # TEST
    ok (($text =~ m/All tests successful\./), "'All tests successful.' string 
as is");
}

# Run several tests.
{
    open ALTOUT, ">", "altout.txt";
    open SAVEOUT, ">&STDOUT";
    open STDOUT, ">&ALTOUT";

    my $tester = Test::Run::Obj->new(
        test_files => 
        [
            "t/sample-tests/simple", 
            "t/sample-tests/head_end",
            "t/sample-tests/todo",
        ],
        );

    $tester->runtests();

    open STDOUT, ">&SAVEOUT";
    close(SAVEOUT);
    close(ALTOUT);

    my $text = do { local $/; local *I; open I, "<", "altout.txt"; <I>};

    # TEST
    ok (($text =~ m/All tests successful/), "'All tests successful' (without 
the period) string as is");
}

>>>>>>>>>>>>>>>>

t/test-failure-report.t:

<<<<<<<<<<<<<<<<
#!/usr/bin/perl -w

BEGIN {
    if( $ENV{PERL_CORE} ) {
        chdir 't';
        @INC = ('../lib', 'lib');
    }
    else {
        unshift @INC, 't/lib';
    }
}

use strict;
use File::Spec;

my $Curdir = File::Spec->curdir;
my $SAMPLE_TESTS = $ENV{PERL_CORE}
                    ? File::Spec->catdir($Curdir, 'lib', 'sample-tests')
                    : File::Spec->catdir($Curdir, 't',   'sample-tests');


use Test::More tests => 1;;

my $IsMacPerl = $^O eq 'MacOS';
my $IsVMS     = $^O eq 'VMS';

# VMS uses native, not POSIX, exit codes.
# MacPerl's exit codes are broken.
my $die_estat = $IsVMS     ? 44 : 
                $IsMacPerl ? 0  :
                             1;

use Test::Run::Obj;


open ALTOUT, ">", "altout.txt";
open SAVEOUT, ">&STDOUT";
open STDOUT, ">&ALTOUT";
    
my $tester = Test::Run::Obj->new(
    test_files => ["t/sample-tests/simple_fail"]
    );
eval {
$tester->runtests();
};

open STDOUT, ">&SAVEOUT";
close(SAVEOUT);
close(ALTOUT);
my $text = do { local $/; open I, "<", "altout.txt"; <I>};
my $right_text = <<"EOF";
t/sample-tests/simple_fail...FAILED tests 2, 5
        Failed 2/5 tests, 60.00% okay
Failed Test                Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
t/sample-tests/simple_fail                5    2  40.00%  2 5
EOF
# TEST
is ($text, $right_text, "Testing for the right failure text");

>>>>>>>>>>>>>>>>

They may use a little cleaning up, but they were still absent from 
Test::Harness. I believe I hit them when I accidently broke stuff, and then 
fixed them while adding these tests.

Regards,

        Shlomi Fish

---------------------------------------------------------------------
Shlomi Fish      [EMAIL PROTECTED]
Homepage:        http://www.shlomifish.org/

95% of the programmers consider 95% of the code they did not write, in the
bottom 5%.

Reply via email to