summaryrefslogtreecommitdiff
path: root/branch_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'branch_test.go')
-rw-r--r--branch_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/branch_test.go b/branch_test.go
new file mode 100644
index 0000000..2b168f5
--- /dev/null
+++ b/branch_test.go
@@ -0,0 +1,26 @@
+package git
+
+import (
+ "testing"
+)
+
+func TestBranchIterator(t *testing.T) {
+
+ repo := createTestRepo(t)
+ seedTestRepo(t, repo)
+
+ i, err := repo.NewBranchIterator(BranchLocal)
+ checkFatal(t, err)
+
+ b, bt, err := i.Next()
+ checkFatal(t, err)
+ if name, _ := b.Name(); name != "master" {
+ t.Fatalf("expected master")
+ } else if bt != BranchLocal {
+ t.Fatalf("expected BranchLocal, not %v", t)
+ }
+ b, bt, err = i.Next()
+ if err != ErrIterOver {
+ t.Fatal("expected iterover")
+ }
+}