Upgrade to Test-Simple-0.82.
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / no_plan.t
CommitLineData
b7f9bbeb 1#!/usr/bin/perl -w
ccbd73a4 2# $Id: /mirror/googlecode/test-more/t/no_plan.t 60319 2008-09-08T21:16:57.125001Z schwern $
b7f9bbeb 3
15db8fc4 4BEGIN {
a9153838 5 if( $ENV{PERL_CORE} ) {
6 chdir 't';
7 @INC = ('../lib', 'lib');
8 }
9 else {
10 unshift @INC, 't/lib';
11 }
15db8fc4 12}
13
ccbd73a4 14use Test::More tests => 9;
4dd974da 15
b7f9bbeb 16my $tb = Test::Builder->create;
17$tb->level(0);
4dd974da 18
b7f9bbeb 19#line 19
20ok !eval { $tb->plan(tests => undef) };
21is($@, "Got an undefined number of tests at $0 line 19.\n");
4dd974da 22
b7f9bbeb 23#line 23
24ok !eval { $tb->plan(tests => 0) };
25is($@, "You said to run 0 tests at $0 line 23.\n");
4dd974da 26
ccbd73a4 27#line 28
b7f9bbeb 28ok !eval { $tb->ok(1) };
ccbd73a4 29is( $@, "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}