This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add core boilerplate to three new Test::Simple tests
[perl5.git] / lib / Test / Simple / t / Builder / done_testing_plan_mismatch.t
CommitLineData
3e887aae
DM
1#!/usr/bin/perl -w
2
3# What if there's a plan and done_testing but they don't match?
4
5use strict;
45d8b36e
DM
6BEGIN {
7 if( $ENV{PERL_CORE} ) {
8 chdir 't';
9 @INC = ('../lib', 'lib');
10 }
11 else {
12 unshift @INC, 't/lib';
13 }
14}
3e887aae
DM
15
16use Test::Builder;
17use Test::Builder::NoOutput;
18
19my $tb = Test::Builder::NoOutput->create;
20
21{
22 # Normalize test output
23 local $ENV{HARNESS_ACTIVE};
24
25 $tb->plan( tests => 3 );
26 $tb->ok(1);
27 $tb->ok(1);
28 $tb->ok(1);
29
30#line 24
31 $tb->done_testing(2);
32}
33
34my $Test = Test::Builder->new;
35$Test->plan( tests => 1 );
36$Test->level(0);
37$Test->is_eq($tb->read, <<"END");
381..3
39ok 1
40ok 2
41ok 3
42not ok 4 - planned to run 3 but done_testing() expects 2
43# Failed test 'planned to run 3 but done_testing() expects 2'
44# at $0 line 24.
45END