qw($TESTOUT $ONFAIL %todo %history $planned @FAILDETAIL)#private-ish
);
-$VERSION = '1.17_00';
+$VERSION = '1.18';
require Exporter;
@ISA=('Exporter');
=head1 DESCRIPTION
+B<STOP!> If you are writing a new test, we I<highly suggest> you use
+the new Test::Simple and Test::More modules instead.
+
L<Test::Harness|Test::Harness> expects to see particular output when it
executes tests. This module aims to make writing proper test scripts just
a little bit easier (and less error prone :-).
L<Test::Unit> is an interesting alternative testing library.
+L<Pod::Tests> and L<SelfTest> let you embed tests in code.
+
=head1 AUTHOR
# -*-perl-*-
use strict;
-use Test;
-BEGIN { plan tests => 4, todo => [2,3] }
+use Test qw(:DEFAULT $TESTOUT $ntest);
+### This test is crafted in such a way as to prevent Test::Harness from
+### seeing the todo tests, otherwise you get people sending in bug reports
+### about Test.pm having "UNEXPECTEDLY SUCCEEDED" tests.
+
+open F, ">mix";
+$TESTOUT = *F{IO};
+
+plan tests => 4, todo => [2,3];
+
+# line 15
ok(sub {
my $r = 0;
for (my $x=0; $x < 10; $x++) {
ok(1);
skip(1,0);
+
+close F;
+$TESTOUT = *STDOUT{IO};
+$ntest = 1;
+
+open F, "mix";
+my $out = join '', <F>;
+close F;
+unlink "mix";
+
+my $expect = <<"EXPECT";
+1..4 todo 2 3;
+ok 1
+not ok 2
+# Failed test 2 in $0 at line 23 *TODO*
+ok 3 # ($0 at line 24 TODO?!)
+ok 4 # skip
+EXPECT
+
+
+print "1..1\n";
+ok( $out, $expect );
ok(ok(1));
ok(ok('fixed', 'fixed'));
-ok(skip(1,0));
+ok(skip("just testing skip()",0));
ok(undef, undef);
ok(ok 'the brown fox jumped over the lazy dog', '/lazy/');
ok(ok 'the brown fox jumped over the lazy dog', 'm,fox,');
# -*-perl-*-
use strict;
-use Test;
-BEGIN {
- my $tests = 5;
- plan tests => $tests, todo => [1..$tests];
-}
+use Test qw(:DEFAULT $TESTOUT $ntest);
-ok(0);
+### This test is crafted in such a way as to prevent Test::Harness from
+### seeing the todo tests, otherwise you get people sending in bug reports
+### about Test.pm having "UNEXPECTEDLY SUCCEEDED" tests.
+
+open F, ">todo";
+$TESTOUT = *F{IO};
+
+my $tests = 5;
+plan tests => $tests, todo => [2..$tests];
+
+# line 11
+ok(1);
ok(1);
ok(0,1);
ok(0,1,"need more tuits");
ok(1,1);
+
+close F;
+$TESTOUT = *STDOUT{IO};
+$ntest = 1;
+
+open F, "todo";
+my $out = join '', <F>;
+close F;
+unlink "todo";
+
+my $expect = <<"EXPECT";
+1..5 todo 2 3 4 5;
+ok 1
+ok 2 # ($0 at line 12 TODO?!)
+not ok 3
+# Test 3 got: '0' ($0 at line 13 *TODO*)
+# Expected: '1'
+not ok 4
+# Test 4 got: '0' ($0 at line 14 *TODO*)
+# Expected: '1' (need more tuits)
+ok 5 # ($0 at line 15 TODO?!)
+EXPECT
+
+
+print "1..1\n";
+ok( $out, $expect );