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
2 changes: 1 addition & 1 deletion constraint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TestNewConstraint(t *testing.T) {
}{
{">= 1.2", 1, false},
{"1.0", 1, false},
{">= 1.x", 0, true},
{">= 1.x", 1, false},
{">= 1.2, < 1.0", 2, false},

// Out of bounds
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var (
// of a version.
const (
VersionRegexpRaw string = `[vV]?([0-9]+(\.[0-9]+)*?)` +
`(-([0-9]+[0-9A-Za-z\-~]*(\.[0-9A-Za-z\-~]+)*)|(-?([A-Za-z\-~]+[0-9A-Za-z\-~]*(\.[0-9A-Za-z\-~]+)*)))?` +
`(-([0-9]+[0-9A-Za-z\-~]*(\.[0-9A-Za-z\-~]+)*)|([-\.]?([A-Za-z\-~]+[0-9A-Za-z\-~]*(\.[0-9A-Za-z\-~]+)*)))?` +
`(\+([0-9A-Za-z\-~]+(\.[0-9A-Za-z\-~]+)*))?` +
`([\+\.\-~]g[0-9A-Fa-f]{10}$)?` +
`?`
Expand Down
8 changes: 6 additions & 2 deletions version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ func TestNewVersion(t *testing.T) {
version string
err bool
}{
// No Error
{"1.2.3", false},
{"1.0", false},
{"1", false},
Expand All @@ -31,9 +32,12 @@ func TestNewVersion(t *testing.T) {
{"2.28.0.618+gf4bc123cb7", false},
{"1.13.0+dev-545-gb3b1c081b", false},
{"2.28.0.618.gf4bc123cb7", false},
{"2.29.0.rc0.261.g7178c9af9c", false},
{"1.2.beta", false},
{"1.21.beta", false},

// Have Error
{"", true},
{"1.2.beta", true},
{"1.21.beta", true},
{"foo", true},
{"\n1.2", true},
{"foo1.2.3", true},
Expand Down