| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Test::Count::Filter; | 
| 2 |  |  |  |  |  |  | $Test::Count::Filter::VERSION = '0.1105'; | 
| 3 | 1 |  |  | 1 |  | 69229 | use warnings; | 
|  | 1 |  |  |  |  | 13 |  | 
|  | 1 |  |  |  |  | 37 |  | 
| 4 | 1 |  |  | 1 |  | 5 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 23 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 1 |  |  | 1 |  | 450 | use parent 'Test::Count::Base'; | 
|  | 1 |  |  |  |  | 327 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 1 |  |  | 1 |  | 434 | use Test::Count      (); | 
|  | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 26 |  | 
| 9 | 1 |  |  | 1 |  | 549 | use Test::Count::Lib (); | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 553 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | sub _counter | 
| 13 |  |  |  |  |  |  | { | 
| 14 | 6 |  |  | 6 |  | 8 | my $self = shift; | 
| 15 | 6 | 100 |  |  |  | 14 | if (@_) | 
| 16 |  |  |  |  |  |  | { | 
| 17 | 3 |  |  |  |  | 8 | $self->{'_counter'} = shift; | 
| 18 |  |  |  |  |  |  | } | 
| 19 | 6 |  |  |  |  | 13 | return $self->{'_counter'}; | 
| 20 |  |  |  |  |  |  | } | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | sub _out_fh | 
| 23 |  |  |  |  |  |  | { | 
| 24 | 36 |  |  | 36 |  | 46 | my $self = shift; | 
| 25 | 36 | 100 |  |  |  | 58 | if (@_) | 
| 26 |  |  |  |  |  |  | { | 
| 27 | 3 |  |  |  |  | 6 | $self->{'_out_fh'} = shift; | 
| 28 |  |  |  |  |  |  | } | 
| 29 | 36 |  |  |  |  | 113 | return $self->{'_out_fh'}; | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | sub _plan_prefix_regex | 
| 33 |  |  |  |  |  |  | { | 
| 34 | 6 |  |  | 6 |  | 13 | my $self = shift; | 
| 35 | 6 | 100 |  |  |  | 17 | if (@_) | 
| 36 |  |  |  |  |  |  | { | 
| 37 | 3 |  |  |  |  | 9 | $self->{'_plan_prefix_regex'} = shift; | 
| 38 |  |  |  |  |  |  | } | 
| 39 | 6 |  |  |  |  | 15 | return $self->{'_plan_prefix_regex'}; | 
| 40 |  |  |  |  |  |  | } | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | sub _assert_prefix_regex | 
| 43 |  |  |  |  |  |  | { | 
| 44 | 0 |  |  | 0 |  | 0 | my $self = shift; | 
| 45 | 0 | 0 |  |  |  | 0 | if (@_) | 
| 46 |  |  |  |  |  |  | { | 
| 47 | 0 |  |  |  |  | 0 | $self->{'_assert_prefix_regex'} = shift; | 
| 48 |  |  |  |  |  |  | } | 
| 49 | 0 |  |  |  |  | 0 | return $self->{'_assert_prefix_regex'}; | 
| 50 |  |  |  |  |  |  | } | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | sub _init | 
| 54 |  |  |  |  |  |  | { | 
| 55 | 3 |  |  | 3 |  | 6 | my $self = shift; | 
| 56 | 3 |  |  |  |  | 6 | my $args = shift; | 
| 57 |  |  |  |  |  |  |  | 
| 58 | 3 |  | 50 |  |  | 12 | $args->{input_fh}          ||= \*STDIN; | 
| 59 | 3 |  | 50 |  |  | 134 | $args->{output_fh}         ||= \*STDOUT; | 
| 60 | 3 |  | 66 |  |  | 34 | $args->{plan_prefix_regex} ||= Test::Count::Lib::perl_plan_prefix_regex(); | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | # Remmed out because Test::Count handles it by itself. | 
| 63 |  |  |  |  |  |  | # if (defined($args->{assert_prefix_regex})) | 
| 64 |  |  |  |  |  |  | # { | 
| 65 |  |  |  |  |  |  | #     $self->_assert_prefix_regex($args->{assert_prefix_regex}); | 
| 66 |  |  |  |  |  |  | # } | 
| 67 | 3 |  |  |  |  | 11 | $self->_plan_prefix_regex( $args->{plan_prefix_regex} ); | 
| 68 | 3 |  |  |  |  | 10 | $self->_out_fh( $args->{output_fh} ); | 
| 69 |  |  |  |  |  |  |  | 
| 70 | 3 |  |  |  |  | 19 | $self->_counter( Test::Count->new($args) ); | 
| 71 |  |  |  |  |  |  |  | 
| 72 | 3 |  |  |  |  | 5 | return 0; | 
| 73 |  |  |  |  |  |  | } | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | sub process | 
| 77 |  |  |  |  |  |  | { | 
| 78 | 3 |  |  | 3 | 1 | 15 | my $self = shift; | 
| 79 |  |  |  |  |  |  |  | 
| 80 | 3 |  |  |  |  | 8 | my $ret = $self->_counter()->process(); | 
| 81 |  |  |  |  |  |  |  | 
| 82 | 3 |  |  |  |  | 1323 | my $count = $ret->{tests_count}; | 
| 83 |  |  |  |  |  |  |  | 
| 84 | 3 |  |  |  |  | 18 | my $plan_re = $self->_plan_prefix_regex(); | 
| 85 |  |  |  |  |  |  |  | 
| 86 | 3 |  |  |  |  | 6 | my @lines = @{ $ret->{lines} }; | 
|  | 3 |  |  |  |  | 72 |  | 
| 87 |  |  |  |  |  |  | LINES_LOOP: | 
| 88 | 3 |  |  |  |  | 16 | while ( my $l = shift(@lines) ) | 
| 89 |  |  |  |  |  |  | { | 
| 90 | 30 | 100 |  |  |  | 463 | if ( $l =~ s{^($plan_re)\d+}{$1$count} ) | 
| 91 |  |  |  |  |  |  | { | 
| 92 | 3 |  |  |  |  | 6 | print { $self->_out_fh() } $l; | 
|  | 3 |  |  |  |  | 6 |  | 
| 93 | 3 |  |  |  |  | 35 | last LINES_LOOP; | 
| 94 |  |  |  |  |  |  | } | 
| 95 |  |  |  |  |  |  | else | 
| 96 |  |  |  |  |  |  | { | 
| 97 | 27 |  |  |  |  | 38 | print { $self->_out_fh() } $l; | 
|  | 27 |  |  |  |  | 42 |  | 
| 98 |  |  |  |  |  |  | } | 
| 99 |  |  |  |  |  |  | } | 
| 100 | 3 |  |  |  |  | 7 | print { $self->_out_fh() } @lines; | 
|  | 3 |  |  |  |  | 8 |  | 
| 101 |  |  |  |  |  |  |  | 
| 102 | 3 |  |  |  |  | 113 | return 0; | 
| 103 |  |  |  |  |  |  | } | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | sub update_assignments | 
| 107 |  |  |  |  |  |  | { | 
| 108 | 0 |  |  | 0 | 1 |  | my ( $self, $args ) = @_; | 
| 109 |  |  |  |  |  |  |  | 
| 110 | 0 |  |  |  |  |  | return $self->_parser()->assignments( $args->{text} ); | 
| 111 |  |  |  |  |  |  | } | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | sub update_count | 
| 115 |  |  |  |  |  |  | { | 
| 116 | 0 |  |  | 0 | 1 |  | my ( $self, $args ) = @_; | 
| 117 |  |  |  |  |  |  |  | 
| 118 | 0 |  |  |  |  |  | return $self->_parser()->update_count( $args->{text} ); | 
| 119 |  |  |  |  |  |  | } | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | sub get_count | 
| 123 |  |  |  |  |  |  | { | 
| 124 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 125 |  |  |  |  |  |  |  | 
| 126 | 0 |  |  |  |  |  | return $self->_parser()->{count}; | 
| 127 |  |  |  |  |  |  | } | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | 1;    # End of Test::Count::Parser | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | __END__ |