Indent the test a bit.
[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
35ok(1, 'Foo');
36ok(0, 'Bar');
37ok(1, 'Yar');
38ok(1, 'Car');
39ok(0, 'Sar');
40
41END {
42 My::Test::ok($$out eq <<OUT);
431..3
44ok 1 - Foo
45not ok 2 - Bar
46ok 3 - Yar
47ok 4 - Car
48not ok 5 - Sar
49OUT
50
15db8fc4 51 My::Test::ok($$err =~ /Looks like you planned 3 tests but ran 2 extra/);
4dd974da 52
53 exit 0;
54}