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