xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/lib/Test/Simple/t/bad_plan.t (revision 0:68f95e015346)
1#!/usr/bin/perl -w
2
3BEGIN {
4    if( $ENV{PERL_CORE} ) {
5        chdir 't';
6        @INC = '../lib';
7    }
8}
9
10my $test_num = 1;
11# Utility testing functions.
12sub 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
26use Test::Builder;
27my $Test = Test::Builder->new;
28
29print "1..2\n";
30
31eval { $Test->plan(7); };
32ok( $@ =~ /^plan\(\) doesn't understand 7/, 'bad plan()' ) ||
33    print STDERR "# $@";
34
35eval { $Test->plan(wibble => 7); };
36ok( $@ =~ /^plan\(\) doesn't understand wibble 7/, 'bad plan()' ) ||
37    print STDERR "# $@";
38
39