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