Skip to content

Commit

Permalink
Merge pull request #6 from jbowes/remove-wildcard-todo
Browse files Browse the repository at this point in the history
Resolve and remove todo on wildcard
  • Loading branch information
jbowes committed Oct 1, 2021
2 parents 575a58d + dbc43db commit a0141fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion constraint.rl
Expand Up @@ -136,7 +136,7 @@ import (
}

num = ('0' | [1-9] [0-9]*) >numstart @num; # TODO: @num might be wrong
wildcard = [xX\*]; # TODO: is this right?
wildcard = [xX*];
major = (num | wildcard >{ bump |= bumpUnbound }) %major %resetnum;
minor = (num | wildcard >{ bump |= bumpMajor }) %minor %resetnum;
patch = (num | wildcard >{ bump |= bumpMinor }) %patch %resetnum;
Expand Down
15 changes: 10 additions & 5 deletions constraint_test.go
Expand Up @@ -112,11 +112,13 @@ func TestParseConstraint(t *testing.T) {
valid bool
canonical string
}{
"wildcard": {"*", true, ">=0.0.0"},
"wildcard (eq)": {"=*", true, ">=0.0.0"},
"unary": {"=1.0", true, ">=1.0.0 <1.1.0"},
"unary (no op)": {"3.4", true, ">=3.4.0 <3.5.0"},
"eq (no value)": {"=", false, ""},
"wildcard": {"*", true, ">=0.0.0"},
"wildcard (x)": {"x", true, ">=0.0.0"},
"wildcard (X)": {"X", true, ">=0.0.0"},
"wildcard ( eq)": {"=*", true, ">=0.0.0"},
"unary": {"=1.0", true, ">=1.0.0 <1.1.0"},
"unary (no op)": {"3.4", true, ">=3.4.0 <3.5.0"},
"eq (no value)": {"=", false, ""},

"less than eq": {"<=4.5.6", true, "<=4.5.6"},
"less than eq (partial)": {"<=4.5", true, "<4.6.0"},
Expand Down Expand Up @@ -146,6 +148,9 @@ func TestParseConstraint(t *testing.T) {
"invalid (union leading zero)": {"2.01 || 15", false, ""},
"invalid (union initial leading zero)": {"01 || 15", false, ""},

"invalid (slash)": {"\\", false, ""},
"invalid (char)": {"a", false, ""},

"spacing": {">= 2.1.x < 3.1.0", true, ">=2.1.0 <3.1.0"},
}

Expand Down

0 comments on commit a0141fb

Please sign in to comment.