MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / TestBaseVersion

Function TestBaseVersion

internal/update/update_test.go:165–186  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

163}
164
165func TestBaseVersion(t *testing.T) {
166 tests := []struct {
167 input, expected string
168 }{
169 {"v0.4.0-61-gd06835b", "0.4.0"},
170 {"0.4.0-61-gd06835b", "0.4.0"},
171 {"v0.5.0", "0.5.0"},
172 {"0.5.0", "0.5.0"},
173 {"1.0.0-beta", "1.0.0-beta"},
174 {"1.0.0-beta-3-gabcdef1", "1.0.0-beta"},
175 {"dev", "dev"},
176 {"v0.4.0-dirty", "0.4.0"},
177 {"0.4.0-81-g1d1ebf3-dirty", "0.4.0"},
178 }
179
180 for _, tc := range tests {
181 result := baseVersion(tc.input)
182 if result != tc.expected {
183 t.Errorf("baseVersion(%q) = %q, want %q", tc.input, result, tc.expected)
184 }
185 }
186}
187
188func TestCompareVersions(t *testing.T) {
189 tests := []struct {

Callers

nothing calls this directly

Calls 1

baseVersionFunction · 0.85

Tested by

no test coverage detected