e39cd4062b7151bf817a2eb6684ee9a622f7bb0a
[dh-make-perl] / dev / arm / libtest-simple-perl / libtest-simple-perl-0.80 / t / plan_is_noplan.t
1 BEGIN {
2     if( $ENV{PERL_CORE} ) {
3         chdir 't';
4         @INC = ('../lib', 'lib');
5     }
6     else {
7         unshift @INC, 't/lib';
8     }
9 }
10
11 # Can't use Test.pm, that's a 5.005 thing.
12 package My::Test;
13
14 print "1..2\n";
15
16 my $test_num = 1;
17 # Utility testing functions.
18 sub ok ($;$) {
19     my($test, $name) = @_;
20     my $ok = '';
21     $ok .= "not " unless $test;
22     $ok .= "ok $test_num";
23     $ok .= " - $name" if defined $name;
24     $ok .= "\n";
25     print $ok;
26     $test_num++;
27 }
28
29
30 package main;
31
32 require Test::Simple;
33
34 require Test::Simple::Catch;
35 my($out, $err) = Test::Simple::Catch::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 }