Commit | Line | Data |
4dd974da |
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 { |
88587957 |
6 | chdir 't' if -d 't'; |
7 | @INC = '../lib'; |
4dd974da |
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) = @_; |
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 | |
15db8fc4 |
35 | push @INC, '../t/lib'; |
d020a79a |
36 | require Test::Simple::Catch::More; |
37 | my($out, $err) = Test::Simple::Catch::More::caught(); |
4dd974da |
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 | } |