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

Function TestSpec_PublicAPI_IsValid

pkg/semverutil/spec_test.go:80–109  ·  view source on GitHub ↗

TestSpec_PublicAPI_IsValid validates the documented behavior of IsValid as described in the semverutil README.md specification.

(t *testing.T)

Source from the content-addressed store, hash-verified

78// TestSpec_PublicAPI_IsValid validates the documented behavior of IsValid as
79// described in the semverutil README.md specification.
80func TestSpec_PublicAPI_IsValid(t *testing.T) {
81 tests := []struct {
82 name string
83 input string
84 expected bool
85 }{
86 {
87 name: "bare version without v prefix is valid",
88 input: "1.2.3",
89 expected: true,
90 },
91 {
92 name: "version with v prefix and prerelease is valid",
93 input: "v1.2.3-beta",
94 expected: true,
95 },
96 {
97 name: "non-semver string is invalid",
98 input: "not-a-ver",
99 expected: false,
100 },
101 }
102
103 for _, tt := range tests {
104 t.Run(tt.name, func(t *testing.T) {
105 result := IsValid(tt.input)
106 assert.Equal(t, tt.expected, result, "IsValid(%q) mismatch", tt.input)
107 })
108 }
109}
110
111// TestSpec_PublicAPI_ParseVersion validates the documented behavior of
112// ParseVersion as described in the semverutil README.md specification.

Callers

nothing calls this directly

Calls 2

IsValidFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected