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