Add test triggering ForeachSubmodule panic.
This commit is contained in:
parent
4a17f8038d
commit
1107c6824f
|
@ -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)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue