Skip to content

Commit

Permalink
do not lose >=0 requirements!
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Mar 5, 2010
1 parent c0c875a commit 9f299a1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Revision history for {{$dist->name}}

{{$NEXT}}
do not lose ">= 0" requirements on merge

0.100530 2010-02-22 21:09:40 America/New_York
add is_simple method to V:R
Expand Down
4 changes: 0 additions & 4 deletions lib/Version/Requirements.pm
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,6 @@ sub from_string_hash {
my ($self, $minimum) = @_;
$self = $self->_self;

# If $minimum is false, it's undef or 0, which cannot be meaningful as a
# minimum. -- rjbs, 2010-02-20
return $self unless $minimum;

if (defined (my $old_min = $self->{minimum})) {
$self->{minimum} = (sort { $b cmp $a } ($minimum, $old_min))[0];
} else {
Expand Down
18 changes: 18 additions & 0 deletions t/merge.t
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,22 @@ sub dies_ok (&@) {
);
}

{
my $left = Version::Requirements->new;
$left->add_minimum(Foo => 0);
$left->add_minimum(Bar => 1);

my $right = Version::Requirements->new;
$right->add_requirements($left);

is_deeply(
$right->as_string_hash,
{
Foo => 0,
Bar => 1,
},
"we do not lose 0-min reqs on merge",
);
}

done_testing;

0 comments on commit 9f299a1

Please sign in to comment.