Commit | Line | Data |
30e302f8 |
1 | #!/usr/bin/perl -w |
2 | |
3 | BEGIN { |
4 | if( $ENV{PERL_CORE} ) { |
5 | chdir 't'; |
6 | @INC = ('../lib', 'lib'); |
7 | } |
8 | else { |
9 | unshift @INC, 't/lib'; |
10 | } |
11 | } |
12 | |
13 | use strict; |
14 | |
15 | require Test::Simple::Catch; |
16 | my($out, $err) = Test::Simple::Catch::caught(); |
17 | |
18 | # Can't use Test.pm, that's a 5.005 thing. |
19 | package My::Test; |
20 | |
b1ddf169 |
21 | # This has to be a require or else the END block below runs before |
22 | # Test::Builder's own and the ending diagnostics don't come out right. |
23 | require Test::Builder; |
24 | my $TB = Test::Builder->create; |
25 | $TB->plan(tests => 2); |
26 | |
27 | sub is { $TB->is_eq(@_) } |
30e302f8 |
28 | |
29 | |
30 | package main; |
31 | |
32 | require Test::Simple; |
33 | Test::Simple->import(tests => 1); |
34 | ok(1); |
35 | ok(1); |
36 | ok(1); |
37 | |
38 | END { |
b1ddf169 |
39 | My::Test::is($$out, <<OUT); |
30e302f8 |
40 | 1..1 |
41 | ok 1 |
42 | ok 2 |
43 | ok 3 |
44 | OUT |
45 | |
b1ddf169 |
46 | My::Test::is($$err, <<ERR); |
30e302f8 |
47 | # Looks like you planned 1 test but ran 2 extra. |
48 | ERR |
49 | |
50 | # Prevent Test::Simple from existing with non-zero |
51 | exit 0; |
52 | } |