Assimilate Test-Simple 0.50
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / missing.t
CommitLineData
15db8fc4 1BEGIN {
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 12package My::Test;
13
14print "1..2\n";
15
16my $test_num = 1;
17# Utility testing functions.
18sub ok ($;$) {
19 my($test, $name) = @_;
11ea77c5 20 my $ok = '';
21 $ok .= "not " unless $test;
22 $ok .= "ok $test_num";
23 $ok .= " - $name" if defined $name;
24 $ok .= "\n";
25 print $ok;
4dd974da 26 $test_num++;
27}
28
29
30package main;
31
32require Test::Simple;
33
d020a79a 34require Test::Simple::Catch;
35my($out, $err) = Test::Simple::Catch::caught();
30e302f8 36local $ENV{HARNESS_ACTIVE} = 0;
4dd974da 37
38Test::Simple->import(tests => 5);
39
0cd946aa 40#line 30
4dd974da 41ok(1, 'Foo');
42ok(0, 'Bar');
43
44END {
45 My::Test::ok($$out eq <<OUT);
461..5
47ok 1 - Foo
48not ok 2 - Bar
49OUT
50
33459055 51 My::Test::ok($$err eq <<ERR);
52# Failed test ($0 at line 31)
53# Looks like you planned 5 tests but only ran 2.
54ERR
4dd974da 55
56 exit 0;
57}