From 006286edb75849a38a33cfbe341d8c92de0e119d Mon Sep 17 00:00:00 2001 From: Jesse Ezell Date: Wed, 19 Mar 2014 00:19:02 -0700 Subject: remove Branch struct, unify reference iterators --- branch_test.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'branch_test.go') 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") + } + } -- cgit v1.2.3