Commit f87c9a3f authored by Cristian Maglie's avatar Cristian Maglie

Updated go.bug.st/relaxed-semver from `634f2c8` to `0265409`

Fix #110
parent a9f6f6e4
......@@ -321,11 +321,11 @@
[[projects]]
branch = "master"
digest = "1:e39f0518cc8a9d0d35fdef12df30ddf1260424a8c8fa3909063b1673a21a7459"
digest = "1:ad7c27ec39e9523a7412cad155c414d0871cb02a8e975dcf269eb2e55edba224"
name = "go.bug.st/relaxed-semver"
packages = ["."]
pruneopts = "UT"
revision = "634f2c8a7dad58007b2539ce542ba69f1e50893c"
revision = "0265409c585220cffdb70af2966e80044958b9a9"
[[projects]]
branch = "master"
......
//
// Copyright 2018 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// +build gofuzz
package semver
// Fuzz is used for fuzzy testing the project
func Fuzz(data []byte) int {
v, err := Parse(string(data))
if err != nil {
if v != nil {
panic("v != nil on error")
}
return 0
}
if v.String() != string(data) {
panic("reserialized string != deserialized string")
}
v.Normalize()
if v.CompareTo(v) != 0 {
panic("compare != 0 while comparing with self")
}
r := ParseRelaxed(string(data))
if r.String() != string(data) {
panic("reserialized relaxed string != deserialized string")
}
return 1
}
......@@ -222,23 +222,26 @@ func Parse(inVersioin string) (*Version, error) {
// Builds parsing
buildIdx := currIdx + 1
for {
if hasNext := next(); !hasNext || curr == '.' {
if buildIdx == currIdx {
return nil, fmt.Errorf("empty build tag not allowed")
if curr == '+' {
for {
if hasNext := next(); !hasNext || curr == '.' {
if buildIdx == currIdx {
return nil, fmt.Errorf("empty build tag not allowed")
}
result.builds = append(result.builds, in[buildIdx:currIdx])
if !hasNext {
return result, nil
}
// Multiple builds
buildIdx = currIdx + 1
continue
}
result.builds = append(result.builds, in[buildIdx:currIdx])
if !hasNext {
return result, nil
if identifier[curr] {
continue
}
// Multiple builds
buildIdx = currIdx + 1
continue
}
if identifier[curr] {
continue
return nil, fmt.Errorf("invalid separator for builds: '%c'", curr)
}
return nil, fmt.Errorf("invalid separator for builds: '%c'", curr)
}
return nil, fmt.Errorf("invalid separator: '%c'", curr)
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment