Upgrade to Test-Simple-0.82.
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / no_plan.t
1 #!/usr/bin/perl -w
2 # $Id: /mirror/googlecode/test-more/t/no_plan.t 60319 2008-09-08T21:16:57.125001Z schwern  $
3
4 BEGIN {
5     if( $ENV{PERL_CORE} ) {
6         chdir 't';
7         @INC = ('../lib', 'lib');
8     }
9     else {
10         unshift @INC, 't/lib';
11     }
12 }
13
14 use Test::More tests => 9;
15
16 my $tb = Test::Builder->create;
17 $tb->level(0);
18
19 #line 19
20 ok !eval { $tb->plan(tests => undef) };
21 is($@, "Got an undefined number of tests at $0 line 19.\n");
22
23 #line 23
24 ok !eval { $tb->plan(tests => 0) };
25 is($@, "You said to run 0 tests at $0 line 23.\n");
26
27 #line 28
28 ok !eval { $tb->ok(1) };
29 is( $@, "You tried to run a test without a plan at $0 line 28.\n");
30
31 {
32     my $warning = '';
33     local $SIG{__WARN__} = sub { $warning .= join '', @_ };
34
35 #line 36
36     ok $tb->plan(no_plan => 1);
37     is( $warning, "no_plan takes no arguments at $0 line 36.\n" );
38     is $tb->has_plan, 'no_plan';
39 }