container/stub: override goexit methods
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 1m52s
Test / Hpkg (push) Successful in 3m34s
Test / Sandbox (race detector) (push) Successful in 4m29s
Test / Hakurei (race detector) (push) Successful in 5m25s
Test / Hakurei (push) Successful in 2m25s
Test / Flake checks (push) Successful in 1m36s

FailNow, Fatal, Fatalf, SkipNow, Skip and Skipf must be called from the goroutine created by the test.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-09-04 04:51:49 +09:00
parent ddfb865e2d
commit 4051577d6b
6 changed files with 157 additions and 49 deletions

View File

@@ -43,8 +43,8 @@ func checkOpBehaviour(t *testing.T, testCases []opBehaviourTestCase) {
ec = (*Criteria)(&tc.ec)
}
defer stub.HandleExit()
sys, s := InternalNew(t, stub.Expect{Calls: slices.Concat(tc.apply, []stub.Call{{Name: stub.CallSeparator}}, tc.revert)}, tc.uid)
defer s.HandleExit()
errApply := tc.op.apply(sys)
s.Expects(stub.CallSeparator)
if !reflect.DeepEqual(errApply, tc.wantErrApply) {
@@ -90,8 +90,8 @@ func checkOpsBuilder(t *testing.T, fname string, testCases []opsBuilderTestCase)
t.Run(tc.name, func(t *testing.T) {
t.Helper()
defer stub.HandleExit()
sys, s := InternalNew(t, tc.exp, tc.uid)
defer s.HandleExit()
tc.f(sys)
s.VisitIncomplete(func(s *stub.Stub[syscallDispatcher]) {
t.Helper()