summaryrefslogtreecommitdiff
path: root/branch_test.go
diff options
context:
space:
mode:
authorJesse Ezell <[email protected]>2014-03-19 00:19:02 -0700
committerJesse Ezell <[email protected]>2014-03-19 00:19:02 -0700
commit006286edb75849a38a33cfbe341d8c92de0e119d (patch)
tree46446da8b8b185a435ab286129e51fef145fb28b /branch_test.go
parent5f01bd7abdd39b4d8c701c8a73f3c3e49fcd70b9 (diff)
remove Branch struct, unify reference iterators
Diffstat (limited to 'branch_test.go')
-rw-r--r--branch_test.go21
1 files changed, 20 insertions, 1 deletions
diff --git a/branch_test.go b/branch_test.go
index e95c877..7db509b 100644
--- a/branch_test.go
+++ b/branch_test.go
@@ -4,7 +4,7 @@ import (
"testing"
)
-func Test_List_Branches(t *testing.T) {
+func TestBranchIterator(t *testing.T) {
repo := createTestRepo(t)
seedTestRepo(t, repo)
@@ -25,4 +25,23 @@ func Test_List_Branches(t *testing.T) {
if err != ErrIterOver {
t.Fatal("expected iterover")
}
+
+ // test channel iterator
+
+ i, err = repo.NewBranchIterator(BranchLocal)
+ checkFatal(t, err)
+
+ list := make([]string, 0)
+ for ref := range ReferenceNameIteratorChannel(i) {
+ list = append(list, ref)
+ }
+
+ if len(list) != 1 {
+ t.Fatal("expected single match")
+ }
+
+ if list[0] != "refs/heads/master" {
+ t.Fatal("expected refs/heads/master")
+ }
+
}