test: refactor factory setup for coverage (#790)
* test: add git helper and guard annotations * chore: align release metadata with 0.40.0 * test: refactor factory setup for coverage
This commit is contained in:
22
cmd/bd/setup/setup_test_helpers.go
Normal file
22
cmd/bd/setup/setup_test_helpers.go
Normal file
@@ -0,0 +1,22 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user