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