blib/lib/Git/Wrapper/Plus/Support/Range.pm untested

filter: Statementstmt 0.0% 0 / 45 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 9 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 79 SCAR 42.8
CC
8
Cov
0%
supports_version
56.0
BUILD
6.0
BEGIN
2.0
CRAP 72.0
1 use 5.008; # utf8
2 use strict;
3 use warnings;
4 use utf8;
5  
6 package Git::Wrapper::Plus::Support::Range;
7 $Git::Wrapper::Plus::Support::Range::VERSION = '0.004010';
8 # ABSTRACT: A record describing a range of supported versions
9  
10 our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30 use Moo qw( has );
31  
32 our @CARP_NOT;
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60 has 'min' => ( is => ro =>, predicate => 'has_min' );
61 has 'max' => ( is => ro =>, predicate => 'has_max' );
62  
63 has 'min_tag' => ( is => ro =>, predicate => 'has_min_tag' );
64 has 'max_tag' => ( is => ro =>, predicate => 'has_max_tag' );
65  
66 has 'min_sha1' => ( is => ro =>, predicate => 'has_min_sha1' );
67 has 'max_sha1' => ( is => ro =>, predicate => 'has_max_sha1' );
68  
69  
70  
71  
72  
73  
74 sub BUILD {
75 my ($self) = @_;
76 if ( not $self->min and not $self->max ) {
77 require Carp;
78 ## no critic (Variables::ProhibitLocalVars)
79 local (@CARP_NOT) = ('Git::Wrapper::Plus::Support::Range');
80 Carp::croak('Invalid range, must specify either min or max, or both');
81 }
82 }
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97 sub supports_version {
98 my ( $self, $versions_object ) = @_;
99 if ( $self->has_min and not $self->has_max ) {
100 return 1 if $versions_object->newer_than( $self->min );
101 return;
102 }
103 if ( $self->has_max and not $self->has_min ) {
104 return 1 if $versions_object->older_than( $self->max );
105 return;
106 }
107 return unless $versions_object->newer_than( $self->min );
108 return unless $versions_object->older_than( $self->max );
109 return 1;
110 }
111  
112 no Moo;
113 1;
114  
115 __END__