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