Commit | Line | Data |
4dd974da |
1 | # Can't use Test.pm, that's a 5.005 thing. |
15db8fc4 |
2 | |
3 | BEGIN { |
4 | chdir 't' if -d 't'; |
5 | @INC = '../lib'; |
6 | } |
7 | |
4dd974da |
8 | package My::Test; |
9 | |
10 | print "1..2\n"; |
11 | |
12 | my $test_num = 1; |
13 | # Utility testing functions. |
14 | sub ok ($;$) { |
15 | my($test, $name) = @_; |
11ea77c5 |
16 | my $ok = ''; |
17 | $ok .= "not " unless $test; |
18 | $ok .= "ok $test_num"; |
19 | $ok .= " - $name" if defined $name; |
20 | $ok .= "\n"; |
21 | print $ok; |
4dd974da |
22 | $test_num++; |
23 | } |
24 | |
25 | |
26 | package main; |
27 | |
28 | require Test::Simple; |
29 | |
15db8fc4 |
30 | push @INC, '../t/lib'; |
d020a79a |
31 | require Test::Simple::Catch; |
32 | my($out, $err) = Test::Simple::Catch::caught(); |
4dd974da |
33 | |
34 | Test::Simple->import(tests => 5); |
35 | |
0cd946aa |
36 | #line 30 |
4dd974da |
37 | ok(1, 'Foo'); |
38 | ok(0, 'Bar'); |
39 | |
40 | END { |
41 | My::Test::ok($$out eq <<OUT); |
42 | 1..5 |
43 | ok 1 - Foo |
44 | not ok 2 - Bar |
45 | OUT |
46 | |
15db8fc4 |
47 | My::Test::ok($$err =~ /Looks like you planned 5 tests but only ran 2/); |
4dd974da |
48 | |
49 | exit 0; |
50 | } |