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