aboutsummaryrefslogtreecommitdiffstats
path: root/library/go/test/testhelpers/recurse.go
blob: 1239d39e018de034ece713274232646c0e11b446 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
package testhelpers

// Recurse calls itself 'depth' times then executes 'f'. Useful for testing things where stack size matters.
func Recurse(depth int, f func()) {
	if depth > 0 {
		depth--
		Recurse(depth, f)
		return
	}

	f()
}