diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-10-10 22:10:15 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-10-10 22:15:20 +0900 |
| commit | 50f6fcb326f81570f12074befa0861a251e9ed5a (patch) | |
| tree | 5ff4f10a7de24257c23967a4eb2fd72f9c51b6c8 /container/stub/stub.go | |
| parent | 070e34658766034927ce5deb19369097938c878c (diff) | |
container/stub: mark test overrides as helper
This fixes line information in test reporting messages.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/stub/stub.go')
| -rw-r--r-- | container/stub/stub.go | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/container/stub/stub.go b/container/stub/stub.go index a5368920..a945fc0a 100644 --- a/container/stub/stub.go +++ b/container/stub/stub.go @@ -45,12 +45,17 @@ func New[K any](tb testing.TB, makeK func(s *Stub[K]) K, want Expect) *Stub[K] { return &Stub[K]{TB: tb, makeK: makeK, want: want, wg: new(sync.WaitGroup)} } -func (s *Stub[K]) FailNow() { panic(panicFailNow) } -func (s *Stub[K]) Fatal(args ...any) { s.Error(args...); panic(panicFatal) } -func (s *Stub[K]) Fatalf(format string, args ...any) { s.Errorf(format, args...); panic(panicFatalf) } -func (s *Stub[K]) SkipNow() { panic("invalid call to SkipNow") } -func (s *Stub[K]) Skip(...any) { panic("invalid call to Skip") } -func (s *Stub[K]) Skipf(string, ...any) { panic("invalid call to Skipf") } +func (s *Stub[K]) FailNow() { s.Helper(); panic(panicFailNow) } +func (s *Stub[K]) Fatal(args ...any) { s.Helper(); s.Error(args...); panic(panicFatal) } +func (s *Stub[K]) Fatalf(format string, args ...any) { + s.Helper() + s.Errorf(format, args...) + panic(panicFatalf) +} + +func (s *Stub[K]) SkipNow() { s.Helper(); panic("invalid call to SkipNow") } +func (s *Stub[K]) Skip(...any) { s.Helper(); panic("invalid call to Skip") } +func (s *Stub[K]) Skipf(string, ...any) { s.Helper(); panic("invalid call to Skipf") } // New calls f in a new goroutine func (s *Stub[K]) New(f func(k K)) { |
