|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #! /usr/bin/perl  | 
| 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
3
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
198857
 | 
 use strict;  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
16
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
220
 | 
    | 
| 
4
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
30
 | 
 use warnings;  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
235
 | 
    | 
| 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package Test::Block;  | 
| 
7
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
40
 | 
 use base qw(Exporter);  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
19
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
714
 | 
    | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our @EXPORT_OK = qw($Plan);  | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
11
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
39
 | 
 use Carp;  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
11
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
531
 | 
    | 
| 
12
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
41
 | 
 use Test::Builder;  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
151
 | 
    | 
| 
13
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
31
 | 
 use Scalar::Util qw( looks_like_number );  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
931
 | 
    | 
| 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 use overload   | 
| 
15
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
56
 | 
     q{""} => \&remaining,  | 
| 
16
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     q{0+} => \&remaining,   | 
| 
17
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
18670
 | 
     fallback => 1;  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7068
 | 
    | 
| 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $VERSION = '0.13';  | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 my $Last_test_in_previous_block = 0;  | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 my $Active_block_count = 0;  | 
| 
23
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
24
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 my $Test_builder = Test::Builder->new;  | 
| 
25
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
  
1
  
 | 
28
 | 
 sub builder { $Test_builder };  | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
27
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 my $Block_count = 0;  | 
| 
28
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
  
1
  
 | 
29
 | 
 sub block_count { $Block_count };  | 
| 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub plan {  | 
| 
31
 | 
19
 | 
 
 | 
 
 | 
  
19
  
 | 
  
1
  
 | 
8587
 | 
     my $class = shift;  | 
| 
32
 | 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
41
 | 
     my ($expected_tests, $name) = (pop, pop);  | 
| 
33
 | 
19
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
222
 | 
     croak "need expected number of tests"  | 
| 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         unless $expected_tests && $expected_tests =~ /^\d+$/s;  | 
| 
35
 | 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
25
 | 
     $Block_count++;  | 
| 
36
 | 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
20
 | 
     $Active_block_count++;  | 
| 
37
 | 
15
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
89
 | 
     return bless {  | 
| 
38
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         name            => defined $name ? $name : $Block_count,  | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         expected_tests  => $expected_tests,  | 
| 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         initial_test    => $Test_builder->current_test,  | 
| 
41
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }, $class;  | 
| 
42
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
44
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _tests_run_in_block {  | 
| 
45
 | 
25
 | 
 
 | 
 
 | 
  
25
  
 | 
 
 | 
42
 | 
     my $self = shift;  | 
| 
46
 | 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
65
 | 
     return $Test_builder->current_test - $self->{initial_test}  | 
| 
47
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
48
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
49
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub remaining {   | 
| 
50
 | 
10
 | 
 
 | 
 
 | 
  
10
  
 | 
  
1
  
 | 
2808
 | 
     my $self = shift;  | 
| 
51
 | 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
31
 | 
     return $self->{expected_tests} - _tests_run_in_block($self);  | 
| 
52
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
53
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub DESTROY {  | 
| 
55
 | 
15
 | 
 
 | 
 
 | 
  
15
  
 | 
 
 | 
3067
 | 
     my $self = shift;  | 
| 
56
 | 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
24
 | 
     $Active_block_count--;  | 
| 
57
 | 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
47
 | 
     $Last_test_in_previous_block = $Test_builder->current_test;  | 
| 
58
 | 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
295
 | 
     my $expected = $self->{expected_tests};  | 
| 
59
 | 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
27
 | 
     my $name = $self->{name};  | 
| 
60
 | 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
80
 | 
     my $tests_ran = _tests_run_in_block($self);  | 
| 
61
 | 
15
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
196
 | 
     $name = "'$name'" unless looks_like_number( $name );  | 
| 
62
 | 
15
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
329
 | 
     $Test_builder->ok(  | 
| 
63
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         0,   | 
| 
64
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         "block $name expected $expected test(s) and ran $tests_ran"  | 
| 
65
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ) unless $tests_ran == $expected;  | 
| 
66
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
67
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
69
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 my $All_tests_in_block = 1;  | 
| 
70
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub all_in_block {   | 
| 
71
 | 
6
 | 
  
100
  
 | 
 
 | 
  
6
  
 | 
  
1
  
 | 
39
 | 
     return unless $All_tests_in_block;  | 
| 
72
 | 
4
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
15
 | 
     return 1 if $Active_block_count > 0;  | 
| 
73
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
     $All_tests_in_block =   | 
| 
74
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         $Last_test_in_previous_block == $Test_builder->current_test;  | 
| 
75
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
18
 | 
     return $All_tests_in_block  | 
| 
76
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
77
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
78
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
79
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 {  | 
| 
80
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     package Test::Block::Plan;  | 
| 
81
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
10196
 | 
     use Tie::Scalar;  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3661
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
174
 | 
    | 
| 
82
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
37
 | 
     use base qw(Tie::StdScalar);      | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4116
 | 
    | 
| 
83
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
84
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     sub STORE {  | 
| 
85
 | 
21
 | 
 
 | 
 
 | 
  
21
  
 | 
 
 | 
3236
 | 
         my ($self, $plan) = @_;  | 
| 
86
 | 
21
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
80
 | 
         if ( defined($plan) && ! eval { $plan->isa( 'Test::Block' ) } ) {  | 
| 
 
 | 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
92
 | 
    | 
| 
87
 | 
7
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
46
 | 
             $plan = Test::Block->plan( ref($plan) ? %$plan : $plan );  | 
| 
88
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         };  | 
| 
89
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
167
 | 
         $self->SUPER::STORE($plan);  | 
| 
90
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
91
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
92
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
93
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $Plan;  | 
| 
94
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 tie $Plan, 'Test::Block::Plan';  | 
| 
95
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
96
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
97
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  |