diff options
| author | Jesse Ezell <[email protected]> | 2014-03-11 12:55:57 -0700 |
|---|---|---|
| committer | Jesse Ezell <[email protected]> | 2014-03-11 12:55:57 -0700 |
| commit | 634acbe498e40e617b4aefcce7a82887a455a04e (patch) | |
| tree | 90d4404350d00b7276096080006e280ec308adff /reference_test.go | |
| parent | 9fb7a746e0103ceff2fd8eb9845e782711a87535 (diff) | |
| parent | 1cf81178141c504c62bb3faaa406db665dc5471a (diff) | |
merge with latest
Diffstat (limited to 'reference_test.go')
| -rw-r--r-- | reference_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/reference_test.go b/reference_test.go index 156960a..ffa9f35 100644 --- a/reference_test.go +++ b/reference_test.go @@ -159,6 +159,33 @@ func TestIterator(t *testing.T) { compareStringList(t, expected, list) } +func TestUtil(t *testing.T) { + repo := createTestRepo(t) + defer os.RemoveAll(repo.Workdir()) + + commitId, _ := seedTestRepo(t, repo) + + ref, err := repo.CreateReference("refs/heads/foo", commitId, true, nil, "") + checkFatal(t, err) + + ref2, err := repo.DwimReference("foo") + checkFatal(t, err) + + if ref.Cmp(ref2) != 0 { + t.Fatalf("foo didn't dwim to the right thing") + } + + if ref.Shorthand() != "foo" { + t.Fatalf("refs/heads/foo has no foo shorthand") + } + + hasLog, err := repo.HasLog("refs/heads/foo") + checkFatal(t, err) + if !hasLog { + t.Fatalf("branches ahve logs by default") + } +} + func compareStringList(t *testing.T, expected, actual []string) { for i, v := range expected { if actual[i] != v { |
