Dpkg/Control/Tests/Entry.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 4 / 4 Conditioncond 66.6% 4 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 91.6% 44 / 48 CC 5 SCAR 8.3
CC
5
Cov
94%
parse
4.0
new
2.1
BEGIN
1.0
CRAP 2.3
« Dpkg/BuildTypes.pm ↑ Summary Dpkg/Exit.pm »
1 # Copyright © 2016 Guillem Jover <guillem@debian.org>
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
15  
16 =encoding utf8
17  
18 =head1 NAME
19  
20 Dpkg::Control::Tests::Entry - represents a test suite entry
21  
22 =head1 DESCRIPTION
23  
24 This class represents a test suite entry.
25  
26 =cut
27  
28 package Dpkg::Control::Tests::Entry 1.00;
29  
30 1 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 1 ▶use Dpkg::Gettext;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 1 ▶use Dpkg::ErrorHandling;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 1 ▶use Dpkg::Control;
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 1 ▶use parent qw(Dpkg::Control);
Subroutine BEGIN: called CC=1 SCAR=0.0
37  
38 =head1 METHODS
39  
40 All the methods of L<Dpkg::Control> are available. Those listed below are
41 either new or overridden with a different behavior.
42  
43 =over 4
44  
45 =item $entry = Dpkg::Control::Tests::Entry->new(%opts)
46  
47 Creates a new object. It does not represent a real control test entry
48 until one has been successfully parsed or built from scratch.
49  
50 The options are passed through to the Dpkg::Control->new() constructor.
51  
52 =cut
53  
54 12 ▶sub new {
Subroutine new: called CC=2 SCAR=7.2
Pod documented
55 12 my ($this, %opts) = @_;
56 12 ▶ my $class = ref($this) || $this;
Condition33%1/3
ref $this || $this
l!l&&r!l&&!r
0120
MC/DC0%0/2
ref $this || $this
ref $this $this
Truth table33%1/3
A || B
A= ref $thisB= $this
ABresult
1X1
011
000
57  
58 12 my $self = Dpkg::Control->new(
59 type => CTRL_TESTS,
60 %opts,
61 );
62 12 bless $self, $class;
63 12 return $self;
64 }
65  
66 =item $bool = $entry->parse($fh, $desc)
67  
68 Parse a control test entry from a filehandle. When called multiple times,
69 the parsed fields are accumulated.
70  
71 Returns true if parsing was a success.
72  
73 =cut
74  
75 12 ▶sub parse {
Subroutine parse: called CC=4 SCAR=13.9
Pod documented
76 12 my ($self, $fh, $desc) = @_;
77  
78 12 ▶ return if not $self->SUPER::parse($fh, $desc);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->SUPER::parse($fh, $desc) 1 10 11
79  
80 10 ▶ if (not exists $self->{'Tests'} and not exists $self->{'Test-Command'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"Tests"} or exists $self->{"Test-Command"}) 1 9 10
Condition100%3/3
exists $self->{"Tests"} or exists $self->{"Test-Command"}
l!l&&r!l&&!r
721
MC/DC100%2/2
exists $self->{"Tests"} or exists $self->{"Test-Command"}
exists $self->{"Tests"} exists $self->{"Test-Command"}
Truth table100%3/3
A or B
A= exists $self->{"Tests"}B= exists $self->{"Test-Command"}
ABresult
1X1
011
000
81 1 $self->parse_error($desc, g_('stanza lacks either %s or %s fields'),
82 'Tests', 'Test-Command');
83 }
84  
85 9 return 1;
86 }
87  
88 =back
89  
90 =head1 CHANGES
91  
92 =head2 Version 1.00 (dpkg 1.18.8)
93  
94 Mark the module as public.
95  
96 =cut
97  
98 1 1;
« Dpkg/BuildTypes.pm ↑ Summary Dpkg/Exit.pm »