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