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