Do a basic test of the walker

This commit is contained in:
Carlos Martín Nieto 2013-09-13 10:57:34 +02:00
parent b5aca803db
commit 56acff247b
1 changed files with 23 additions and 0 deletions

23
walk_test.go Normal file
View File

@ -0,0 +1,23 @@
package git
import (
"os"
"testing"
)
func TestWalk(t *testing.T) {
repo := createTestRepo(t)
defer os.RemoveAll(repo.Workdir())
commitId, _ := seedTestRepo(t, repo)
walk, err := repo.Walk()
checkFatal(t, err)
walk.Push(commitId)
walk.Sorting(SortTime | SortReverse)
var id Oid
err = walk.Next(&id)
checkFatal(t, err)
if id.Cmp(commitId) != 0 {
t.Fatal("Bad id returned")
}
}