Upgrade to Test-Simple-0.82.
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / plan_is_noplan.t
1 # $Id: /mirror/googlecode/test-more/t/plan_is_noplan.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 print "1..2\n";
16
17 my $test_num = 1;
18 # Utility testing functions.
19 sub ok ($;$) {
20     my($test, $name) = @_;
21     my $ok = '';
22     $ok .= "not " unless $test;
23     $ok .= "ok $test_num";
24     $ok .= " - $name" if defined $name;
25     $ok .= "\n";
26     print $ok;
27     $test_num++;
28 }
29
30
31 package main;
32
33 require Test::Simple;
34
35 require Test::Simple::Catch;
36 my($out, $err) = Test::Simple::Catch::caught();
37
38
39 Test::Simple->import('no_plan');
40
41 ok(1, 'foo');
42
43
44 END {
45     My::Test::ok($$out eq <<OUT);
46 ok 1 - foo
47 1..1
48 OUT
49
50     My::Test::ok($$err eq <<ERR);
51 ERR
52
53     # Prevent Test::Simple from exiting with non zero
54     exit 0;
55 }