Commit | Line | Data |
15db8fc4 |
1 | BEGIN { |
2 | chdir 't' if -d 't'; |
3 | @INC = '../lib'; |
4 | } |
5 | |
4dd974da |
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) = @_; |
11ea77c5 |
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; |
4dd974da |
21 | $test_num++; |
22 | } |
23 | |
24 | |
25 | package main; |
26 | |
27 | require Test::Simple; |
28 | |
15db8fc4 |
29 | push @INC, '../t/lib'; |
d020a79a |
30 | require Test::Simple::Catch; |
31 | my($out, $err) = Test::Simple::Catch::caught(); |
4dd974da |
32 | |
33 | Test::Simple->import(tests => 3); |
34 | |
35 | ok(1, 'Foo'); |
36 | ok(0, 'Bar'); |
37 | ok(1, 'Yar'); |
38 | ok(1, 'Car'); |
39 | ok(0, 'Sar'); |
40 | |
41 | END { |
42 | My::Test::ok($$out eq <<OUT); |
43 | 1..3 |
44 | ok 1 - Foo |
45 | not ok 2 - Bar |
46 | ok 3 - Yar |
47 | ok 4 - Car |
48 | not ok 5 - Sar |
49 | OUT |
50 | |
15db8fc4 |
51 | My::Test::ok($$err =~ /Looks like you planned 3 tests but ran 2 extra/); |
4dd974da |
52 | |
53 | exit 0; |
54 | } |