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