MCPcopy Create free account
hub / github.com/antonmedv/gitmal / TestParseRefNames_Singles

Function TestParseRefNames_Singles

pkg/git/git_test.go:43–64  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41}
42
43func TestParseRefNames_Singles(t *testing.T) {
44 cases := []struct {
45 in string
46 kind RefKind
47 name string
48 target string
49 }{
50 {"tag: v2", RefKindTag, "v2", ""},
51 {"main", RefKindBranch, "main", ""},
52 {"origin/dev", RefKindRemote, "origin/dev", ""},
53 {"origin/HEAD -> origin/main", RefKindRemoteHEAD, "origin/HEAD", "origin/main"},
54 }
55 for _, c := range cases {
56 got := parseRefNames(c.in)
57 if len(got) != 1 {
58 t.Fatalf("%q: expected 1 entry, got %d (%v)", c.in, len(got), got)
59 }
60 if got[0].Kind != c.kind || got[0].Name != c.name || got[0].Target != c.target {
61 t.Errorf("%q: unexpected entry: %+v", c.in, got[0])
62 }
63 }
64}

Callers

nothing calls this directly

Calls 2

parseRefNamesFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected