summaryrefslogtreecommitdiff
path: root/branch_test.go
diff options
context:
space:
mode:
authorJesse Ezell <[email protected]>2014-03-12 15:49:11 -0700
committerJesse Ezell <[email protected]>2014-03-12 15:49:11 -0700
commit5f01bd7abdd39b4d8c701c8a73f3c3e49fcd70b9 (patch)
tree3c30d127effd815d910371eb3a1fbac711d9f4aa /branch_test.go
parent1cf81178141c504c62bb3faaa406db665dc5471a (diff)
add branch iterator / remove useless repo from reference iterator
Diffstat (limited to 'branch_test.go')
-rw-r--r--branch_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/branch_test.go b/branch_test.go
new file mode 100644
index 0000000..e95c877
--- /dev/null
+++ b/branch_test.go
@@ -0,0 +1,28 @@
+package git
+
+import (
+ "testing"
+)
+
+func Test_List_Branches(t *testing.T) {
+
+ repo := createTestRepo(t)
+ seedTestRepo(t, repo)
+
+ i, err := repo.NewBranchIterator(BranchLocal)
+ checkFatal(t, err)
+
+ ref, err := i.Next()
+ checkFatal(t, err)
+ if ref.Name() != "refs/heads/master" {
+ t.Fatalf("expected refs/heads/master, not %v", ref.Name())
+ }
+ ref, err = i.Next()
+ if ref != nil {
+ t.Fatal("expected nil")
+ }
+
+ if err != ErrIterOver {
+ t.Fatal("expected iterover")
+ }
+}