Submodule foreach fix #171

Merged
pks-t merged 2 commits from submodule-foreach-fix into master 2015-01-29 08:15:28 -06:00
1 changed files with 24 additions and 0 deletions
Showing only changes of commit 1107c6824f - Show all commits

24
submodule_test.go Normal file
View File

@ -0,0 +1,24 @@
package git
import (
"testing"
)
func TestSubmoduleForeach(t *testing.T) {
repo := createTestRepo(t)
seedTestRepo(t, repo)
_, err := repo.AddSubmodule("http://example.org/submodule", "submodule", true)
checkFatal(t, err)
i := 0
err = repo.ForeachSubmodule(func(sub *Submodule, name string) int {
i++
return 0
})
checkFatal(t, err)
if i != 1 {
t.Fatalf("expected one submodule found but got %i", i)
}
}