TestSet.pm

filter: Statementstmt 95.3% 41 / 43 Branchbran 70.0% 7 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.0% 9 / 10 Podpod 100% 2 / 2 totaltotal 90.7% 59 / 65 CC 7 SCAR 11.4
CC
7
Cov
91%
passed
6.2
__ANON__
2.0
as_tap
2.0
CRAP 3.1
« Parser.pm ↑ Summary BailOut.pm »
1 package TAP::Spec::TestSet;
2 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 $TAP::Spec::TestSet::AUTHORITY = 'cpan:ARODLAND';
4 }
5 {
6 2 $TAP::Spec::TestSet::VERSION = '0.10';
7 }
8 # ABSTRACT: A set of related TAP tests
9 2 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 ▶use TAP::Spec::Body ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use TAP::Spec::Plan ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use TAP::Spec::Header ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶use TAP::Spec::Footer ();
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17  
18 2 has 'body' => (
19 is => 'rw',
20 isa => 'TAP::Spec::Body',
21 handles => {
22 lines => 'lines',
23 tests => 'tests',
24 body_comments => 'comments',
25 },
26 required => 1,
27 );
28  
29  
30 2 has 'plan' => (
31 is => 'rw',
32 isa => 'TAP::Spec::Plan',
33 );
34  
35  
36 has version => (
37 is => 'rw',
38 isa => 'Int',
39 lazy => 1,
40 3 ▶ default => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
41 3 my $self = shift;
42  
43 3 ▶ if( my $v = $self->header->version ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $v = $self->header->version) { } 1 2 3
44 1 return $v->version_number;
45 }
46 else {
47 2 return 12;
48 }
49 }
50 2 );
51  
52  
53 2 has 'header' => (
54 is => 'rw',
55 isa => 'TAP::Spec::Header',
56 handles => {
57 header_comments => 'comments',
58 },
59 required => 1,
60 );
61  
62  
63 2 has 'footer' => (
64 is => 'rw',
65 isa => 'TAP::Spec::Footer',
66 handles => {
67 footer_comments => 'comments',
68 },
69 required => 1,
70 );
71  
72  
73 0 ▶sub as_tap {
Subroutine as_tap: not called CC=1 SCAR=6.9
Pod documented
74 0 my ($self) = @_;
75  
76 0 return $self->plan->as_tap() .
77 $self->header->as_tap() .
78 $self->body->as_tap() .
79 $self->footer->as_tap();
80 }
81  
82  
83 4 ▶sub passed {
Subroutine passed: called CC=6 SCAR=18.2
Pod documented
84 4 my $self = shift;
85  
86 4 ▶ return '' unless $self->plan;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->plan 0 4 4
87 4 my $expected = $self->plan->number_of_tests;
88  
89 4 my @tests = $self->tests;
90 4 ▶ return '' unless @tests == $expected;
Branch: 1 branch
BranchTrueFalseTotal
unless @tests == $expected 0 4 4
91  
92 4 my $count = 1;
93 4 for my $test (@tests) {
94 6 ▶ return '' unless $test->passed;
Branch: 1 branch
BranchTrueFalseTotal
unless $test->passed 1 5 6
95 5 ▶ return '' unless $test->number == $count++;
Branch: 1 branch
BranchTrueFalseTotal
unless $test->number == $count++ 0 5 5
96 }
97  
98 3 return 1;
99 }
100  
101 2 __PACKAGE__->meta->make_immutable;
102  
103 __END__
« Parser.pm ↑ Summary BailOut.pm »