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