This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
bump version to 5.16.0 RC0
[perl5.git] / cpan / Test / t / onfail.t
CommitLineData
809908f7
MS
1# -*-perl-*-
2
3use strict;
711cdd39 4use Test qw($ntest plan ok $TESTOUT $TESTERR);
809908f7
MS
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};
711cdd39 15$TESTERR = *J{IO};
809908f7
MS
16ok(0, 1, $why);
17$TESTOUT = *STDOUT{IO};
711cdd39 18$TESTERR = *STDERR{IO};
809908f7
MS
19close J;
20unlink "junk";
21$ntest = 1;
22
23sub myfail {
24 my ($f) = @_;
25 ok(@$f, 1);
26
27 my $t = $$f[0];
28 ok($$t{diagnostic}, $why);
29 ok($$t{'package'}, 'main');
30 ok($$t{repetition}, 1);
31 ok($$t{result}, 0);
32 ok($$t{expected}, 1);
33}