Upgrade to Test-Simple-0.82.
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / missing.t
1 # $Id: /mirror/googlecode/test-more/t/missing.t 57943 2008-08-18T02:09:22.275428Z brooklyn.kid51  $
2 BEGIN {
3     if( $ENV{PERL_CORE} ) {
4         chdir 't';
5         @INC = ('../lib', 'lib');
6     }
7     else {
8         unshift @INC, 't/lib';
9     }
10 }
11
12 # Can't use Test.pm, that's a 5.005 thing.
13 package My::Test;
14
15 # This has to be a require or else the END block below runs before
16 # Test::Builder's own and the ending diagnostics don't come out right.
17 require Test::Builder;
18 my $TB = Test::Builder->create;
19 $TB->plan(tests => 2);
20
21 sub is { $TB->is_eq(@_) }
22
23
24 package main;
25
26 require Test::Simple;
27
28 require Test::Simple::Catch;
29 my($out, $err) = Test::Simple::Catch::caught();
30 local $ENV{HARNESS_ACTIVE} = 0;
31
32 Test::Simple->import(tests => 5);
33
34 #line 30
35 ok(1, 'Foo');
36 ok(0, 'Bar');
37 ok(1, '1 2 3');
38
39 END {
40     My::Test::is($$out, <<OUT);
41 1..5
42 ok 1 - Foo
43 not ok 2 - Bar
44 ok 3 - 1 2 3
45 OUT
46
47     My::Test::is($$err, <<ERR);
48 #   Failed test 'Bar'
49 #   at $0 line 31.
50 #     You named your test '1 2 3'.  You shouldn't use numbers for your test names.
51 #     Very confusing.
52 # Looks like you planned 5 tests but ran 3.
53 # Looks like you failed 1 test of 3 run.
54 ERR
55
56     exit 0;
57 }