Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public boolean isPattern() {
@Override
public boolean contains(VersionIdentifier version) {

VersionSegment start = version.getStart();
if ((start.getNumber() == -1) && start.isPattern()) {
return true; // * and *! are always contained
}
if (this.min != null) {
VersionComparisonResult compareMin = version.compareVersion(this.min);
if (compareMin.isLess()) {
Expand All @@ -82,7 +86,7 @@ public boolean contains(VersionIdentifier version) {
VersionComparisonResult compareMax = version.compareVersion(this.max);
if (compareMax.isGreater()) {
return false;
} else if (compareMax.isEqual() && this.boundaryType.isRightExclusive() && !version.isPattern()) {
} else if (compareMax.isEqual() && this.boundaryType.isRightExclusive()) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,12 @@ public void testContains() {
checkContainsNot("(11,22)", "10*");
checkContains("(11,22)", "11*");
checkContains("(11,22)", "11.0*");
checkContains("(11,22)", "22*");
checkContains("(11,22)", "22.*");
checkContains("(11,22)", "21.99*");
checkContainsNot("(11,22)", "22*");
checkContainsNot("(11,22)", "22.*");
checkContainsNot("(11,22)", "23*");
checkContains("(11,22)", "21.99*");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
checkContains("(11,22)", "21.99*");
checkContains("(11,22)", "21.99.*");

Due this line is identical to line 122 I think this is a copy/paste error and you forgot to add a "" between "99" and "*".

checkContains("[22,)", "*");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not really get the sense of this check. If you substitute "[22,)" with
"[,)" ,
"(
,)" or
"(,)"
the check is still true.

Could you please add a small "//" comment to explain what is special with this test?

}

private void checkContains(String range, String version) {
Expand Down