(t *testing.T)
| 12 | } |
| 13 | |
| 14 | func TestParseRefNames_Mixed(t *testing.T) { |
| 15 | input := "HEAD -> main, tag: v1.0.0, origin/HEAD -> origin/main, origin/main, master" |
| 16 | got := parseRefNames(input) |
| 17 | if len(got) != 5 { |
| 18 | t.Fatalf("expected 5 entries, got %d (%v)", len(got), got) |
| 19 | } |
| 20 | |
| 21 | // 1: HEAD pointer |
| 22 | if got[0].Kind != RefKindHEAD || got[0].Name != "HEAD" || got[0].Target != "main" { |
| 23 | t.Errorf("unexpected HEAD entry: %+v", got[0]) |
| 24 | } |
| 25 | // 2: tag |
| 26 | if got[1].Kind != RefKindTag || got[1].Name != "v1.0.0" || got[1].Target != "" { |
| 27 | t.Errorf("unexpected Tag entry: %+v", got[1]) |
| 28 | } |
| 29 | // 3: remote HEAD pointer |
| 30 | if got[2].Kind != RefKindRemoteHEAD || got[2].Name != "origin/HEAD" || got[2].Target != "origin/main" { |
| 31 | t.Errorf("unexpected RemoteHEAD entry: %+v", got[2]) |
| 32 | } |
| 33 | // 4: remote branch |
| 34 | if got[3].Kind != RefKindRemote || got[3].Name != "origin/main" || got[3].Target != "" { |
| 35 | t.Errorf("unexpected Remote entry: %+v", got[3]) |
| 36 | } |
| 37 | // 5: local branch |
| 38 | if got[4].Kind != RefKindBranch || got[4].Name != "master" || got[4].Target != "" { |
| 39 | t.Errorf("unexpected Branch entry: %+v", got[4]) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | func TestParseRefNames_Singles(t *testing.T) { |
| 44 | cases := []struct { |
nothing calls this directly
no test coverage detected