Test::Simple 0.32
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / plan_is_noplan.t
1 BEGIN {
2     chdir 't' if -d 't';
3     @INC = '../lib';
4 }
5
6 # Can't use Test.pm, that's a 5.005 thing.
7 package My::Test;
8
9 # This feature requires a fairly new version of Test::Harness
10 BEGIN {
11     require Test::Harness;
12     if( $Test::Harness::VERSION < 1.20 ) {
13         print "1..0 # Skipped: Need Test::Harness 1.20 or up\n";
14         exit(0);
15     }
16 }
17
18 print "1..2\n";
19
20 my $test_num = 1;
21 # Utility testing functions.
22 sub ok ($;$) {
23     my($test, $name) = @_;
24     my $ok = '';
25     $ok .= "not " unless $test;
26     $ok .= "ok $test_num";
27     $ok .= " - $name" if defined $name;
28     $ok .= "\n";
29     print $ok;
30     $test_num++;
31 }
32
33
34 package main;
35
36 require Test::Simple;
37
38 push @INC, '../t/lib';
39 require Test::Simple::Catch;
40 my($out, $err) = Test::Simple::Catch::caught();
41
42
43 Test::Simple->import('no_plan');
44
45 ok(1, 'foo');
46
47
48 END {
49     My::Test::ok($$out eq <<OUT);
50 ok 1 - foo
51 1..1
52 OUT
53
54     My::Test::ok($$err eq <<ERR);
55 ERR
56
57     # Prevent Test::Simple from exiting with non zero
58     exit 0;
59 }