diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-09-04 04:51:49 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-09-04 04:51:49 +0900 |
| commit | 4051577d6b037e9d9dbeaa8817b906f7b3a8eb26 (patch) | |
| tree | 23b7c68ad3128cf980c4ede60cfe99ddf557cc51 /container/dispatcher_test.go | |
| parent | ddfb865e2d526485935099a8cd454929ed5f6176 (diff) | |
container/stub: override goexit methods
FailNow, Fatal, Fatalf, SkipNow, Skip and Skipf must be called from the goroutine created by the test.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/dispatcher_test.go')
| -rw-r--r-- | container/dispatcher_test.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/container/dispatcher_test.go b/container/dispatcher_test.go index 18800466..20a100b8 100644 --- a/container/dispatcher_test.go +++ b/container/dispatcher_test.go @@ -148,8 +148,8 @@ func checkSimple(t *testing.T, fname string, testCases []simpleTestCase) { t.Run(tc.name, func(t *testing.T) { t.Helper() - defer stub.HandleExit() k := &kstub{stub.New(t, func(s *stub.Stub[syscallDispatcher]) syscallDispatcher { return &kstub{s} }, tc.want)} + defer k.HandleExit() if err := tc.f(k); !reflect.DeepEqual(err, tc.wantErr) { t.Errorf("%s: error = %v, want %v", fname, err, tc.wantErr) } @@ -184,12 +184,12 @@ func checkOpBehaviour(t *testing.T, testCases []opBehaviourTestCase) { t.Run(tc.name, func(t *testing.T) { t.Helper() - defer stub.HandleExit() state := &setupState{Params: tc.params} k := &kstub{stub.New(t, func(s *stub.Stub[syscallDispatcher]) syscallDispatcher { return &kstub{s} }, stub.Expect{Calls: slices.Concat(tc.early, []stub.Call{{Name: stub.CallSeparator}}, tc.apply)}, )} + defer k.HandleExit() errEarly := tc.op.early(state, k) k.Expects(stub.CallSeparator) if !reflect.DeepEqual(errEarly, tc.wantErrEarly) { |
