Commit | Line | Data |
33459055 |
1 | BEGIN { |
2 | chdir 't' if -d 't'; |
3 | @INC = '../lib'; |
4 | } |
5 | |
6 | # Can't use Test.pm, that's a 5.005 thing. |
7 | package My::Test; |
8 | |
9 | print "1..2\n"; |
10 | |
11 | my $test_num = 1; |
12 | # Utility testing functions. |
13 | sub ok ($;$) { |
14 | my($test, $name) = @_; |
15 | my $ok = ''; |
16 | $ok .= "not " unless $test; |
17 | $ok .= "ok $test_num"; |
18 | $ok .= " - $name" if defined $name; |
19 | $ok .= "\n"; |
20 | print $ok; |
21 | $test_num++; |
22 | } |
23 | |
24 | |
25 | package main; |
26 | |
27 | require Test::More; |
28 | Test::More->import; |
29 | my($out, $err); |
30 | |
31 | BEGIN { |
32 | require Test::Harness; |
33 | } |
34 | |
35 | if( $Test::Harness::VERSION < 1.20 ) { |
36 | plan(skip_all => 'Need Test::Harness 1.20 or up'); |
37 | } |
38 | else { |
39 | push @INC, '../t/lib'; |
40 | require Test::Simple::Catch; |
41 | ($out, $err) = Test::Simple::Catch::caught(); |
42 | plan('no_plan'); |
43 | } |
44 | |
45 | pass('Just testing'); |
46 | ok(1, 'Testing again'); |
47 | |
48 | END { |
49 | My::Test::ok($$out eq <<OUT); |
50 | ok 1 - Just testing |
51 | ok 2 - Testing again |
52 | 1..2 |
53 | OUT |
54 | |
55 | My::Test::ok($$err eq ''); |
56 | } |