New upstream snapshot.
Debian Janitor
4 years ago
|
0 |
golang-github-knqyf263-go-deb-version (0.0~git20190517.09fca49-1) UNRELEASED; urgency=medium
|
|
1 |
|
|
2 |
* New upstream snapshot.
|
|
3 |
|
|
4 |
-- Debian Janitor <janitor@jelmer.uk> Sun, 23 Jun 2019 04:23:28 +0000
|
|
5 |
|
0 | 6 |
golang-github-knqyf263-go-deb-version (0.0~git20170509.9865fe1-2) unstable; urgency=medium
|
1 | 7 |
|
2 | 8 |
* Move to salsa.debian.org.
|
119 | 119 |
return nil
|
120 | 120 |
}
|
121 | 121 |
|
|
122 |
// Valid validates the version
|
|
123 |
func Valid(ver string) bool {
|
|
124 |
_, err := NewVersion(ver)
|
|
125 |
return err == nil
|
|
126 |
}
|
|
127 |
|
122 | 128 |
// Equal returns whether this version is equal with another version.
|
123 | 129 |
func (v1 *Version) Equal(v2 Version) bool {
|
124 | 130 |
return v1.Compare(v2) == 0
|
72 | 72 |
}
|
73 | 73 |
}
|
74 | 74 |
|
|
75 |
func TestValid(t *testing.T) {
|
|
76 |
cases := []struct {
|
|
77 |
version string
|
|
78 |
expected bool
|
|
79 |
}{
|
|
80 |
{"1.2.3", true},
|
|
81 |
{"1:1.2.3", true},
|
|
82 |
{"A:1.2.3", false},
|
|
83 |
{"-1:1.2.3", false},
|
|
84 |
{"6.0-4.el6.x86_64", true},
|
|
85 |
{"6.0-9ubuntu1.5", true},
|
|
86 |
{"2:7.4.052-1ubuntu3.1", true},
|
|
87 |
{"2:-1ubuntu3.1", false},
|
|
88 |
{"2:A7.4.052-1ubuntu3.1", false},
|
|
89 |
{"2:7.4.!052-1ubuntu3.1", false},
|
|
90 |
{"7.4.052-!1ubuntu3.1", false},
|
|
91 |
}
|
|
92 |
|
|
93 |
for _, tc := range cases {
|
|
94 |
actual := Valid(tc.version)
|
|
95 |
if actual != tc.expected {
|
|
96 |
t.Fatalf(
|
|
97 |
"valid: %s\nexpected: %t\nactual: %t",
|
|
98 |
tc.version, tc.expected, actual)
|
|
99 |
}
|
|
100 |
}
|
|
101 |
}
|
75 | 102 |
func TestEqual(t *testing.T) {
|
76 | 103 |
cases := []struct {
|
77 | 104 |
v1 Version
|