Debian lenny version packages
[pkg-perl] / deb-src / libtest-simple-perl / libtest-simple-perl-0.80 / t / bad_plan.t
1 #!/usr/bin/perl -w
2
3 BEGIN {
4     if( $ENV{PERL_CORE} ) {
5         chdir 't';
6         @INC = '../lib';
7     }
8 }
9
10 my $test_num = 1;
11 # Utility testing functions.
12 sub ok ($;$) {
13     my($test, $name) = @_;
14     my $ok = '';
15     $ok .= "not " unless $test;
16     $ok .= "ok $test_num";
17     $ok .= " - $name" if defined $name;
18     $ok .= "\n";
19     print $ok;
20     $test_num++;
21
22     return $test;
23 }
24
25
26 use Test::Builder;
27 my $Test = Test::Builder->new;
28
29 print "1..2\n";
30
31 eval { $Test->plan(7); };
32 ok( $@ =~ /^plan\(\) doesn't understand 7/, 'bad plan()' ) ||
33     print STDERR "# $@";
34
35 eval { $Test->plan(wibble => 7); };
36 ok( $@ =~ /^plan\(\) doesn't understand wibble 7/, 'bad plan()' ) ||
37     print STDERR "# $@";
38