TPath/Selector/Test/ClosestMatch.pm

filter: Statementstmt 60.0% 9 / 15 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod n/a totaltotal 52.1% 12 / 23 CC 2 SCAR 10.0
CC
2
Cov
53%
to_string
6.0
BUILD
2.0
candidates
2.0
CRAP 2.7
« demo.pl ↑ Summary TPath/Selector/Test/ClosestTag.pm »
1 package TPath::Selector::Test::ClosestMatch;
2 $TPath::Selector::Test::ClosestMatch::VERSION = '1.007';
3 # ABSTRACT: handles C</E<gt>~foo~>
4  
5 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use TPath::Test::Node::Match;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 with 'TPath::Selector::Test::Match';
11  
12 has rx => ( is => 'ro', isa => 'RegexpRef', required => 1 );
13  
14 0 ▶sub BUILD {
Subroutine BUILD: not called CC=1 SCAR=6.9
15 0 my $self = shift;
16 0 $self->_node_test( TPath::Test::Node::Match->new( rx => $self->rx ) );
17 }
18  
19 # implements method required by TPath::Selector::Test
20 0 ▶sub candidates {
Subroutine candidates: not called CC=1 SCAR=6.9
21 0 my ( $self, $ctx, $first ) = @_;
22 0 return $ctx->i->f->closest( $ctx, $self->node_test, !$first );
23 }
24 0 ▶sub to_string {
Subroutine to_string: not called CC=2 SCAR=17.9
25 0 my $self = shift;
26 return
27 0 ▶ '/>'
Branch: 1 branch
BranchTrueFalseTotal
$self->is_inverted ? : 0 0 0
28 . ( $self->is_inverted ? '^' : '' )
29 . $self->_stringify_match( $self->val );
30 }
31  
32 __PACKAGE__->meta->make_immutable;
33  
34 1;
35  
36 __END__
« demo.pl ↑ Summary TPath/Selector/Test/ClosestTag.pm »