1#!/usr/bin/perl -w
2
3BEGIN {
4    if( $ENV{PERL_CORE} ) {
5        chdir 't';
6        @INC = ('../lib', 'lib');
7    }
8    else {
9        unshift @INC, 't/lib';
10    }
11}
12
13use Test::More tests => 7;
14
15my $tb = Test::Builder->create;
16
17# TB methods expect to be wrapped
18my $ok           = sub { shift->ok(@_) };
19my $plan         = sub { shift->plan(@_) };
20my $done_testing = sub { shift->done_testing(@_) };
21
22#line 20
23ok !eval { $tb->$plan(tests => undef) };
24is($@, "Got an undefined number of tests at $0 line 20.\n");
25
26#line 24
27ok !eval { $tb->$plan(tests => 0) };
28is($@, "You said to run 0 tests at $0 line 24.\n");
29
30{
31    my $warning = '';
32    local $SIG{__WARN__} = sub { $warning .= join '', @_ };
33
34#line 31
35    ok $tb->$plan(no_plan => 1);
36    is( $warning, "no_plan takes no arguments at $0 line 31.\n" );
37    is $tb->has_plan, 'no_plan';
38}
39