* test: add git helper and guard annotations * chore: align release metadata with 0.40.0 * test: refactor factory setup for coverage
23 lines
317 B
Go
23 lines
317 B
Go
package setup
|
|
|
|
import "testing"
|
|
|
|
type exitCapture struct {
|
|
called bool
|
|
code int
|
|
}
|
|
|
|
func stubSetupExit(t *testing.T) *exitCapture {
|
|
t.Helper()
|
|
cap := &exitCapture{}
|
|
orig := setupExit
|
|
setupExit = func(code int) {
|
|
cap.called = true
|
|
cap.code = code
|
|
}
|
|
t.Cleanup(func() {
|
|
setupExit = orig
|
|
})
|
|
return cap
|
|
}
|