(t *testing.T)
| 70 | } |
| 71 | |
| 72 | func 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 | } |
nothing calls this directly
no test coverage detected