diff options
| author | Carlos Martín Nieto <[email protected]> | 2014-04-26 20:25:26 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2014-04-26 20:25:26 +0200 |
| commit | 605f942e940a7b69803030e8ca843fa0f94ae7d8 (patch) | |
| tree | 9333add7e39257a178d56822ef6335b1d2de4b8d /branch_test.go | |
| parent | 3cf0b6db80885c63986001f3217019bdf2295b71 (diff) | |
| parent | a7d3c5955ac9426dd57bf4d3df87ca1eba049789 (diff) | |
Merge pull request #66 from jezell/branch-iterator
Add branch iterator
Diffstat (limited to 'branch_test.go')
| -rw-r--r-- | branch_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/branch_test.go b/branch_test.go new file mode 100644 index 0000000..44f6338 --- /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 !IsErrorCode(err, ErrIterOver) { + t.Fatal("expected iterover") + } +} |
