Files
git2go/submodule_test.go
lhchavez 5def02a589 The big Callback type adjustment of 2020
This change makes all callbacks that can fail return an `error`. This
makes things a lot more idiomatic.
2021-09-05 18:52:01 -07:00

28 lines
479 B
Go

package git
import (
"testing"
)
func TestSubmoduleForeach(t *testing.T) {
t.Parallel()
repo := createTestRepo(t)
defer cleanupTestRepo(t, repo)
seedTestRepo(t, repo)
_, err := repo.Submodules.Add("http://example.org/submodule", "submodule", true)
checkFatal(t, err)
i := 0
err = repo.Submodules.Foreach(func(sub *Submodule, name string) error {
i++
return nil
})
checkFatal(t, err)
if i != 1 {
t.Fatalf("expected one submodule found but got %d", i)
}
}