Commit | Line | Data |
ccbd73a4 |
1 | # $Id: /mirror/googlecode/test-more/t/plan_is_noplan.t 57943 2008-08-18T02:09:22.275428Z brooklyn.kid51 $ |
33459055 |
2 | BEGIN { |
a9153838 |
3 | if( $ENV{PERL_CORE} ) { |
4 | chdir 't'; |
5 | @INC = ('../lib', 'lib'); |
6 | } |
7 | else { |
8 | unshift @INC, 't/lib'; |
9 | } |
33459055 |
10 | } |
11 | |
4dd974da |
12 | # Can't use Test.pm, that's a 5.005 thing. |
13 | package My::Test; |
14 | |
4dd974da |
15 | print "1..2\n"; |
16 | |
17 | my $test_num = 1; |
18 | # Utility testing functions. |
19 | sub ok ($;$) { |
20 | my($test, $name) = @_; |
11ea77c5 |
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; |
4dd974da |
27 | $test_num++; |
28 | } |
29 | |
30 | |
31 | package main; |
32 | |
33 | require Test::Simple; |
34 | |
33459055 |
35 | require Test::Simple::Catch; |
36 | my($out, $err) = Test::Simple::Catch::caught(); |
4dd974da |
37 | |
38 | |
39 | Test::Simple->import('no_plan'); |
40 | |
41 | ok(1, 'foo'); |
42 | |
43 | |
44 | END { |
45 | My::Test::ok($$out eq <<OUT); |
46 | ok 1 - foo |
47 | 1..1 |
48 | OUT |
49 | |
50 | My::Test::ok($$err eq <<ERR); |
51 | ERR |
52 | |
53 | # Prevent Test::Simple from exiting with non zero |
54 | exit 0; |
55 | } |