Skip to content

Commit

Permalink
Leave out unnecessary '>= 0' in string output
Browse files Browse the repository at this point in the history
  • Loading branch information
Leont committed Jun 26, 2024
1 parent df35b2c commit 2cc24ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/CPAN/Meta/Requirements/Range.pm
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ sub as_string {
my @parts = @{ $self->as_struct };

return $parts[0][1] if @parts == 1 and $parts[0][0] eq '>=';
@parts = grep { $_->[0] ne '>=' || $_->[1] != 0 } @parts;

return join q{, }, map {; join q{ }, @$_ } @parts;
}
Expand Down
5 changes: 5 additions & 0 deletions t/basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,9 @@ sub foo_1 {

}

{
my $r = CPAN::Meta::Requirements::Range->with_string_requirement(">= 0, < 2");
is($r->as_string, '< 2', ">= 0 is filtered out when there's a maximum defined");
}

done_testing;

0 comments on commit 2cc24ce

Please sign in to comment.