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