Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow prereleases to contain x #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
11 changes: 6 additions & 5 deletions v4/range.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,13 @@ func expandWildcardVersion(parts [][]string) ([][]string, error) {
for _, p := range parts {
var newParts []string
for _, ap := range p {
if strings.Contains(ap, "x") {
opStr, vStr, err := splitComparatorVersion(ap)
if err != nil {
return nil, err
}

opStr, vStr, err := splitComparatorVersion(ap)
if err != nil {
return nil, err
}
Comment on lines +331 to +334
Copy link
Author

Choose a reason for hiding this comment

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

This was moved up to not break the following expandedWildcardVersions test case: {[][]string{{"foox"}}, nil}.


if strings.Contains(ap, ".x") {
versionWildcardType := getWildcardType(vStr)
flatVersion := createVersionFromWildcard(vStr)

Expand Down
4 changes: 4 additions & 0 deletions v4/range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ func TestExpandWildcardVersion(t *testing.T) {
o [][]string
}{
{[][]string{{"foox"}}, nil},
{[][]string{{"0.1.0-x"}}, [][]string{{"0.1.0-x"}}},
{[][]string{{">=1.2.x"}}, [][]string{{">=1.2.0"}}},
{[][]string{{"<=1.2.x"}}, [][]string{{"<1.3.0"}}},
{[][]string{{">1.2.x"}}, [][]string{{">=1.3.0"}}},
Expand Down Expand Up @@ -485,6 +486,9 @@ func TestParseRange(t *testing.T) {
{"2.9.9", true},
{"3.0.0", false},
}},
{"0.1.0-x", []tv{
{"0.1.0-x", true},
}},
}

for _, tc := range tests {
Expand Down