MCPcopy Create free account
hub / github.com/github/gh-aw / TestPreciseVersionPreference

Function TestPreciseVersionPreference

pkg/cli/semver_precise_test.go:72–104  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

70}
71
72func TestPreciseVersionPreference(t *testing.T) {
73 // Test that when comparing equal versions, major-only versions are preferred
74 // This follows GitHub Actions convention of using major version tags (e.g., v8 instead of v8.0.0)
75 v6 := parseVersion("v6")
76 v600 := parseVersion("v6.0.0")
77
78 if v6 == nil || v600 == nil {
79 t.Fatal("Failed to parse versions")
80 }
81
82 // They should parse to the same major.minor.patch
83 if v6.Major != v600.Major || v6.Minor != v600.Minor || v6.Patch != v600.Patch {
84 t.Errorf("v6 and v6.0.0 should parse to same major.minor.patch, got v6=%+v, v600=%+v", v6, v600)
85 }
86
87 // v6.0.0 should be precise, v6 should not
88 if !v600.IsPreciseVersion() {
89 t.Error("v6.0.0 should be precise")
90 }
91
92 if v6.IsPreciseVersion() {
93 t.Error("v6 should not be precise")
94 }
95
96 // Neither should be considered "newer" than the other
97 if v6.IsNewer(v600) {
98 t.Error("v6 should not be newer than v6.0.0")
99 }
100
101 if v600.IsNewer(v6) {
102 t.Error("v6.0.0 should not be newer than v6")
103 }
104}

Callers

nothing calls this directly

Calls 5

IsPreciseVersionMethod · 0.80
IsNewerMethod · 0.80
parseVersionFunction · 0.70
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected