[PATCH] Syncing with Test::Simple 0.19
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / missing.t
1 # Can't use Test.pm, that's a 5.005 thing.
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6 }
7
8 package My::Test;
9
10 print "1..2\n";
11
12 my $test_num = 1;
13 # Utility testing functions.
14 sub ok ($;$) {
15     my($test, $name) = @_;
16     my $ok = '';
17     $ok .= "not " unless $test;
18     $ok .= "ok $test_num";
19     $ok .= " - $name" if defined $name;
20     $ok .= "\n";
21     print $ok;
22     $test_num++;
23 }
24
25
26 package main;
27
28 require Test::Simple;
29
30 push @INC, '../t/lib';
31 require Test::Simple::Catch;
32 my($out, $err) = Test::Simple::Catch::caught();
33
34 Test::Simple->import(tests => 5);
35
36 #line 30
37 ok(1, 'Foo');
38 ok(0, 'Bar');
39
40 END {
41     My::Test::ok($$out eq <<OUT);
42 1..5
43 ok 1 - Foo
44 not ok 2 - Bar
45 OUT
46
47     My::Test::ok($$err =~ /Looks like you planned 5 tests but only ran 2/);
48
49     exit 0;
50 }