The Grand Trek: move the *.t files from t/ to lib/ and ext/.
[p5sagit/p5-mst-13.2.git] / lib / Test / t / onfail.t
CommitLineData
809908f7 1# -*-perl-*-
2
3use strict;
4use Test qw($ntest plan ok $TESTOUT);
5use vars qw($mycnt);
6
7BEGIN { plan test => 6, onfail => \&myfail }
8
9$mycnt = 0;
10
11my $why = "zero != one";
12# sneak in a test that Test::Harness wont see
13open J, ">junk";
14$TESTOUT = *J{IO};
15ok(0, 1, $why);
16$TESTOUT = *STDOUT{IO};
17close J;
18unlink "junk";
19$ntest = 1;
20
21sub myfail {
22 my ($f) = @_;
23 ok(@$f, 1);
24
25 my $t = $$f[0];
26 ok($$t{diagnostic}, $why);
27 ok($$t{'package'}, 'main');
28 ok($$t{repetition}, 1);
29 ok($$t{result}, 0);
30 ok($$t{expected}, 1);
31}