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