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

Function TestShortRef

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

Source from the content-addressed store, hash-verified

399}
400
401func TestShortRef(t *testing.T) {
402 tests := []struct {
403 name string
404 ref string
405 want string
406 }{
407 {name: "branch ref", ref: "refs/heads/main", want: "main"},
408 {name: "tag ref", ref: "refs/tags/v1.0", want: "v1.0"},
409 {name: "short name passthrough", ref: "main", want: "main"},
410 {name: "bare SHA passthrough", ref: "abc123", want: "abc123"},
411 {name: "empty passthrough", ref: "", want: ""},
412 }
413 for _, tt := range tests {
414 t.Run(tt.name, func(t *testing.T) {
415 assert.Equal(t, tt.want, ShortRef(tt.ref))
416 })
417 }
418}
419
420func TestResolveRef(t *testing.T) {
421 tests := []struct {

Callers

nothing calls this directly

Calls 3

ShortRefFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected