MCPcopy
hub / github.com/superplanehq/superplane / TestIsNewerVersion

Function TestIsNewerVersion

pkg/cli/version_test.go:9–36  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestIsNewerVersion(t *testing.T) {
10 tests := []struct {
11 name string
12 current string
13 latest string
14 expected bool
15 }{
16 {"minor bump", "v0.13.0", "v0.14.0", true},
17 {"patch bump", "v0.13.0", "v0.13.1", true},
18 {"major bump", "v0.13.0", "v1.0.0", true},
19 {"same version", "v0.13.0", "v0.13.0", false},
20 {"current is newer minor", "v0.14.0", "v0.13.0", false},
21 {"current is newer major", "v1.0.0", "v0.99.99", false},
22 {"no v prefix", "0.13.0", "0.14.0", true},
23 {"mixed prefixes", "v0.13.0", "0.14.0", true},
24 {"multi-digit versions", "v0.9.0", "v0.10.0", true},
25 {"current is newer patch", "v0.13.2", "v0.13.1", false},
26 }
27
28 for _, tt := range tests {
29 t.Run(tt.name, func(t *testing.T) {
30 result := isNewerVersion(tt.current, tt.latest)
31 if result != tt.expected {
32 t.Errorf("isNewerVersion(%q, %q) = %v, want %v", tt.current, tt.latest, result, tt.expected)
33 }
34 })
35 }
36}
37
38func TestIsDevBuild(t *testing.T) {
39 original := Version

Callers

nothing calls this directly

Calls 3

isNewerVersionFunction · 0.85
ErrorfMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected