Commit | Line | Data |
4dd974da |
1 | use strict; |
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 | |
15db8fc4 |
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 => 5); |
36 | |
0cd946aa |
37 | #line 32 |
4dd974da |
38 | ok( 1, 'passing' ); |
39 | ok( 2, 'passing still' ); |
40 | ok( 3, 'still passing' ); |
41 | ok( 0, 'oh no!' ); |
42 | ok( 0, 'damnit' ); |
43 | |
44 | |
45 | END { |
46 | My::Test::ok($$out eq <<OUT); |
47 | 1..5 |
48 | ok 1 - passing |
49 | ok 2 - passing still |
50 | ok 3 - still passing |
51 | not ok 4 - oh no! |
52 | not ok 5 - damnit |
53 | OUT |
54 | |
cb26d8ba |
55 | My::Test::ok($$err =~ /Looks like you failed 2 tests of 5/); |
4dd974da |
56 | |
57 | # Prevent Test::Simple from exiting with non zero |
58 | exit 0; |
59 | } |