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

Function TestCompareVersions

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

Source from the content-addressed store, hash-verified

186}
187
188func TestCompareVersions(t *testing.T) {
189 tests := []struct {
190 current, latest string
191 expected bool
192 }{
193 {"0.5.0", "0.5.1", true},
194 {"0.5.0", "0.5.0", false},
195 {"v0.5.0", "v0.5.0", false},
196 {"dev", "1.0.0", false},
197 {"1.0.0", "2.0.0", true},
198 // Dev builds ahead of a tag should not report update available
199 {"0.4.0-61-gd06835b", "0.4.0", false},
200 {"v0.4.0-61-gd06835b", "v0.4.0", false},
201 // Dev builds should report update when a newer release exists
202 {"0.4.0-61-gd06835b", "0.5.0", true},
203 }
204
205 for _, tc := range tests {
206 result := CompareVersions(tc.current, tc.latest)
207 if result != tc.expected {
208 t.Errorf("CompareVersions(%q, %q) = %v, want %v", tc.current, tc.latest, result, tc.expected)
209 }
210 }
211}
212
213func TestFindAssets(t *testing.T) {
214 assets := []Asset{

Callers

nothing calls this directly

Calls 1

CompareVersionsFunction · 0.85

Tested by

no test coverage detected