Upgrade to Test::Simple 0.53
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / fail_one.t
CommitLineData
30e302f8 1#!/usr/bin/perl -w
2
3BEGIN {
4 if( $ENV{PERL_CORE} ) {
5 chdir 't';
6 @INC = ('../lib', 'lib');
7 }
8 else {
9 unshift @INC, 't/lib';
10 }
11}
12
13use strict;
14
15require Test::Simple::Catch;
16my($out, $err) = Test::Simple::Catch::caught();
17local $ENV{HARNESS_ACTIVE} = 0;
18
19
20# Can't use Test.pm, that's a 5.005 thing.
21package My::Test;
22
23print "1..2\n";
24
25my $test_num = 1;
26# Utility testing functions.
27sub ok ($;$) {
28 my($test, $name) = @_;
29 my $ok = '';
30 $ok .= "not " unless $test;
31 $ok .= "ok $test_num";
32 $ok .= " - $name" if defined $name;
33 $ok .= "\n";
34 print $ok;
35 $test_num++;
36
37 return $test ? 1 : 0;
38}
39
40
41package main;
42
43require Test::Simple;
44Test::Simple->import(tests => 1);
45
46#line 45
47ok(0);
48
49END {
50 My::Test::ok($$out eq <<OUT);
511..1
52not ok 1
53OUT
54
7483b81c 55 My::Test::ok($$err eq <<ERR) || print $$err;
30e302f8 56# Failed test ($0 at line 45)
57# Looks like you failed 1 test of 1.
58ERR
59
60 # Prevent Test::Simple from existing with non-zero
61 exit 0;
62}