Commit | Line | Data |
---|---|---|
15db8fc4 | 1 | BEGIN { |
a9153838 | 2 | if( $ENV{PERL_CORE} ) { |
3 | chdir 't'; | |
4 | @INC = ('../lib', 'lib'); | |
5 | } | |
6 | else { | |
7 | unshift @INC, 't/lib'; | |
8 | } | |
15db8fc4 | 9 | } |
10 | ||
33459055 | 11 | # Can't use Test.pm, that's a 5.005 thing. |
4dd974da | 12 | package My::Test; |
13 | ||
b1ddf169 | 14 | # This has to be a require or else the END block below runs before |
15 | # Test::Builder's own and the ending diagnostics don't come out right. | |
16 | require Test::Builder; | |
17 | my $TB = Test::Builder->create; | |
18 | $TB->plan(tests => 2); | |
19 | ||
20 | sub is { $TB->is_eq(@_) } | |
4dd974da | 21 | |
22 | ||
23 | package main; | |
24 | ||
25 | require Test::Simple; | |
26 | ||
d020a79a | 27 | require Test::Simple::Catch; |
28 | my($out, $err) = Test::Simple::Catch::caught(); | |
30e302f8 | 29 | local $ENV{HARNESS_ACTIVE} = 0; |
4dd974da | 30 | |
31 | Test::Simple->import(tests => 5); | |
32 | ||
0cd946aa | 33 | #line 30 |
4dd974da | 34 | ok(1, 'Foo'); |
35 | ok(0, 'Bar'); | |
ccbd73a4 | 36 | ok(1, '1 2 3'); |
4dd974da | 37 | |
38 | END { | |
b1ddf169 | 39 | My::Test::is($$out, <<OUT); |
4dd974da | 40 | 1..5 |
41 | ok 1 - Foo | |
42 | not ok 2 - Bar | |
ccbd73a4 | 43 | ok 3 - 1 2 3 |
4dd974da | 44 | OUT |
45 | ||
b1ddf169 | 46 | My::Test::is($$err, <<ERR); |
47 | # Failed test 'Bar' | |
b7f9bbeb | 48 | # at $0 line 31. |
ccbd73a4 | 49 | # You named your test '1 2 3'. You shouldn't use numbers for your test names. |
50 | # Very confusing. | |
51 | # Looks like you planned 5 tests but ran 3. | |
52 | # Looks like you failed 1 test of 3 run. | |
33459055 | 53 | ERR |
4dd974da | 54 | |
55 | exit 0; | |
56 | } |