Update to Text::Balanced 1.85.
[p5sagit/p5-mst-13.2.git] / t / lib / Test / onfail.t
1 # -*-perl-*-
2
3 use strict;
4 use Test qw($ntest plan ok $TESTOUT);
5 use vars qw($mycnt);
6
7 BEGIN { plan test => 6, onfail => \&myfail }
8
9 $mycnt = 0;
10
11 my $why = "zero != one";
12 # sneak in a test that Test::Harness wont see
13 open J, ">junk";
14 $TESTOUT = *J{IO};
15 ok(0, 1, $why);
16 $TESTOUT = *STDOUT{IO};
17 close J;
18 unlink "junk";
19 $ntest = 1;
20
21 sub 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 }