This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
& what's to be done for 5.8.0?
[perl5.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     chdir 't' if -d 't';
7     @INC = '../lib';
8     require Test::Harness;
9     if( $Test::Harness::VERSION < 1.20 ) {
10         print "1..0\n";
11         exit(0);
12     }
13 }
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 push @INC, '../t/lib';
36 require Test::Simple::Catch::More;
37 my($out, $err) = Test::Simple::Catch::More::caught();
38
39
40 Test::Simple->import('no_plan');
41
42 ok(1, 'foo');
43
44
45 END {
46     My::Test::ok($$out eq <<OUT);
47 ok 1 - foo
48 1..1
49 OUT
50
51     My::Test::ok($$err eq <<ERR);
52 ERR
53
54     # Prevent Test::Simple from exiting with non zero
55     exit 0;
56 }