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:
Jordan Hubbard
2025-12-29 18:15:56 -04:00
committed by GitHub
parent 96c7cceefc
commit 8f8a075943
14 changed files with 316 additions and 490 deletions

View 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
}