blib/lib/Aspect/Library/TestClass.pm

filter: Statementstmt 64.4% 29 / 45 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 9 / 12 Podpod 0.0% 0 / 2 totaltotal 55.0% 38 / 69 CC 6 SCAR 27.5
CC
6
Cov
53%
__ANON__
42.0
make_subject
2.0
get_advice
2.0
CRAP 15.6
↑ Summary
1 package Aspect::Library::TestClass;
2  
3 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Test::Class 0.33 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Params::Util 1.00 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Aspect::Modular 1.00 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Aspect::Advice::Before ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Aspect::Pointcut::And ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Aspect::Pointcut::Call ();
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 our $VERSION = '1.00';
14 1 our @ISA = 'Aspect::Modular';
15  
16 0 ▶sub Test::Class::make_subject {
Subroutine make_subject: not called CC=1 SCAR=6.9
Pod undocumented
17 0 shift->subject_class->new(@_);
18 }
19  
20 0 ▶sub get_advice {
Subroutine get_advice: not called CC=1 SCAR=6.9
Pod undocumented
21 0 my $self = shift;
22 0 my $pointcut = shift;
23 Aspect::Advice::Before->new(
24 lexical => $self->lexical,
25 pointcut => Aspect::Pointcut::And->new(
26 Aspect::Pointcut::Call->new(qr/::[a-z][^:]*$/),
27 $pointcut,
28 ),
29 0 ▶ code => sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
30 0 my $self = $_->self;
31 0 my @method = ( $_->package_name, $_->short_name );
32  
33 # Are we in a test class, in a test method, and can
34 # we get a subject_class from the test class.
35 # Would be nice if we could check for existence of test
36 # attribute on the method.
37 0 ▶ Params::Util::_INSTANCE($self, 'Test::Class') or return;
Branch: 1 branch
BranchTrueFalseTotal
&Params::Util::_INSTANCE($self, "Test::Class") or return 0 0 0
38 0 ▶ $self->_method_info(@method) or return;
Branch: 1 branch
BranchTrueFalseTotal
$self->_method_info(@method) or return 0 0 0
39 0 ▶ $self->can('subject_class') or return;
Branch: 1 branch
BranchTrueFalseTotal
$self->can("subject_class") or return 0 0 0
40  
41 0 my @params = ();
42 0 ▶ if ( $self->can('subject_params') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can("subject_params")) 0 0 0
43 0 @params = $self->subject_params;
44 }
45 0 my $subject = $self->make_subject(@params);
46 0 ▶ if ( $self->can('init_subject_state') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can("init_subject_state")) 0 0 0
47 0 $self->init_subject_state($subject)
48 }
49 0 $_->args( $_->args, $subject );
50 },
51 0 );
52 }
53  
54 1 1;
55  
56 __END__
↑ Summary