MCPcopy Create free account
hub / github.com/cli/cli / TestValidateName

Function TestValidateName

internal/skills/discovery/discovery_test.go:335–357  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

333}
334
335func TestValidateName(t *testing.T) {
336 tests := []struct {
337 name string
338 input string
339 want bool
340 }{
341 {name: "empty", input: "", want: false},
342 {name: "too long", input: strings.Repeat("a", 65), want: false},
343 {name: "max length is valid", input: strings.Repeat("a", 64), want: true},
344 {name: "contains slash", input: "foo/bar", want: false},
345 {name: "contains dotdot", input: "foo..bar", want: false},
346 {name: "starts with dot", input: ".hidden", want: false},
347 {name: "simple name", input: "code-review", want: true},
348 {name: "with dots and underscores", input: "octocat_helper.v2", want: true},
349 {name: "uppercase allowed", input: "Octocat", want: true},
350 {name: "single char", input: "a", want: true},
351 }
352 for _, tt := range tests {
353 t.Run(tt.name, func(t *testing.T) {
354 assert.Equal(t, tt.want, validateName(tt.input))
355 })
356 }
357}
358
359func TestIsSpecCompliant(t *testing.T) {
360 tests := []struct {

Callers

nothing calls this directly

Calls 3

validateNameFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected