Upgrade to Test-Simple-0.82.
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / plan_bad.t
CommitLineData
7483b81c 1#!/usr/bin/perl -w
ccbd73a4 2# $Id: /mirror/googlecode/test-more/t/plan_bad.t 57943 2008-08-18T02:09:22.275428Z brooklyn.kid51 $
7483b81c 3
4BEGIN {
5 if( $ENV{PERL_CORE} ) {
6 chdir 't';
7 @INC = '../lib';
8 }
9}
10
11
ccbd73a4 12use Test::More tests => 12;
b7f9bbeb 13use Test::Builder;
14my $tb = Test::Builder->create;
15$tb->level(0);
7483b81c 16
b7f9bbeb 17ok !eval { $tb->plan( tests => 'no_plan' ); };
18is $@, sprintf "Number of tests must be a positive integer. You gave it 'no_plan' at %s line %d.\n", $0, __LINE__ - 1;
7483b81c 19
20my $foo = [];
21my @foo = ($foo, 2, 3);
b7f9bbeb 22ok !eval { $tb->plan( tests => @foo ) };
23is $@, sprintf "Number of tests must be a positive integer. You gave it '$foo' at %s line %d.\n", $0, __LINE__ - 1;
24
ccbd73a4 25ok !eval { $tb->plan( tests => 9.99 ) };
26is $@, sprintf "Number of tests must be a positive integer. You gave it '9.99' at %s line %d.\n", $0, __LINE__ - 1;
27
b7f9bbeb 28#line 25
29ok !eval { $tb->plan( tests => -1 ) };
30is $@, "Number of tests must be a positive integer. You gave it '-1' at $0 line 25.\n";
31
32#line 29
33ok !eval { $tb->plan( tests => '' ) };
34is $@, "You said to run 0 tests at $0 line 29.\n";
7483b81c 35
b7f9bbeb 36#line 33
37ok !eval { $tb->plan( 'wibble' ) };
38is $@, "plan() doesn't understand wibble at $0 line 33.\n";