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