| 14 | ) |
| 15 | |
| 16 | func TestRefString(t *testing.T) { |
| 17 | const sha = "0000000000000000000000000000000000000000" |
| 18 | for s, r := range map[string]*Ref{ |
| 19 | "refs/heads/master": { |
| 20 | Name: "master", |
| 21 | Type: RefTypeLocalBranch, |
| 22 | Sha: sha, |
| 23 | }, |
| 24 | "refs/remotes/origin/master": { |
| 25 | Name: "origin/master", |
| 26 | Type: RefTypeRemoteBranch, |
| 27 | Sha: sha, |
| 28 | }, |
| 29 | "refs/tags/v1.0.0": { |
| 30 | Name: "v1.0.0", |
| 31 | Type: RefTypeLocalTag, |
| 32 | Sha: sha, |
| 33 | }, |
| 34 | "HEAD": { |
| 35 | Name: "HEAD", |
| 36 | Type: RefTypeHEAD, |
| 37 | Sha: sha, |
| 38 | }, |
| 39 | "other": { |
| 40 | Name: "other", |
| 41 | Type: RefTypeOther, |
| 42 | Sha: sha, |
| 43 | }, |
| 44 | } { |
| 45 | assert.Equal(t, s, r.Refspec()) |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | func TestParseRefs(t *testing.T) { |
| 50 | tests := map[string]RefType{ |