summaryrefslogtreecommitdiff
path: root/branch_test.go
diff options
context:
space:
mode:
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")
+ }
+}