Rewhack Test-Simple into core harness.
[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     my $ok = '';
20     $ok .= "not " unless $test;
21     $ok .= "ok $test_num";
22     $ok .= " - $name" if defined $name;
23     $ok .= "\n";
24     print $ok;
25     $test_num++;
26 }
27
28
29 package main;
30
31 require Test::Simple;
32
33 push @INC, '../t/lib';
34 require Test::Simple::Catch::More;
35 my($out, $err) = Test::Simple::Catch::More::caught();
36
37
38 Test::Simple->import('no_plan');
39
40 ok(1, 'foo');
41
42
43 END {
44     My::Test::ok($$out eq <<OUT);
45 ok 1 - foo
46 1..1
47 OUT
48
49     My::Test::ok($$err eq <<ERR);
50 ERR
51
52     # Prevent Test::Simple from exiting with non zero
53     exit 0;
54 }