This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
8c4492ab95486a8953cfd28b49cef5890a0aeedd
[perl5.git] / lib / Test / Simple / t / plan_no_plan.t
1 BEGIN {
2     if( $ENV{PERL_CORE} ) {
3         chdir 't';
4         @INC = '../lib';
5     }
6 }
7
8 use Test::More;
9
10 BEGIN {
11     if( !$ENV{HARNESS_ACTIVE} && $ENV{PERL_CORE} ) {
12         plan skip_all => "Won't work with t/TEST";
13     }
14 }
15
16 BEGIN {
17     require Test::Harness;
18 }
19
20 # This feature requires a fairly new version of Test::Harness
21 if( $Test::Harness::VERSION < 2.03 ) {
22     plan tests => 1;
23     diag "Need Test::Harness 2.03 or up.  You have $Test::Harness::VERSION.";
24     fail 'Need Test::Harness 2.03 or up';
25     exit;
26 }
27
28 plan 'no_plan';
29
30 pass('Just testing');
31 ok(1, 'Testing again');
32
33 {
34     my $warning = '';
35     local $SIG{__WARN__} = sub { $warning = join "", @_ };
36     SKIP: {
37         skip 'Just testing skip with no_plan';
38         fail("So very failed");
39     }
40     is( $warning, '', 'skip with no "how_many" ok with no_plan' );
41
42
43     $warning = '';
44     TODO: {
45         todo_skip "Just testing todo_skip";
46
47         fail("Just testing todo");
48         die "todo_skip should prevent this";
49         pass("Again");
50     }
51     is( $warning, '', 'skip with no "how_many" ok with no_plan' );
52 }