diff options
Diffstat (limited to 'branch_test.go')
| -rw-r--r-- | branch_test.go | 21 |
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") + } + } |
