container/stub: mark test overrides as helper
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Hpkg (push) Successful in 4m2s
Test / Sandbox (race detector) (push) Successful in 4m35s
Test / Sandbox (push) Successful in 1m24s
Test / Hakurei (race detector) (push) Successful in 5m23s
Test / Hakurei (push) Successful in 2m16s
Test / Flake checks (push) Successful in 1m21s
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Hpkg (push) Successful in 4m2s
Test / Sandbox (race detector) (push) Successful in 4m35s
Test / Sandbox (push) Successful in 1m24s
Test / Hakurei (race detector) (push) Successful in 5m23s
Test / Hakurei (push) Successful in 2m16s
Test / Flake checks (push) Successful in 1m21s
This fixes line information in test reporting messages. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
070e346587
commit
50f6fcb326
@ -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)) {
|
||||
|
@ -43,7 +43,7 @@ func TestStub(t *testing.T) {
|
||||
t.Errorf("recover: %v", r)
|
||||
}
|
||||
}()
|
||||
new(stubHolder).FailNow()
|
||||
stubHolder{&Stub[stubHolder]{TB: t}}.FailNow()
|
||||
})
|
||||
|
||||
t.Run("SkipNow", func(t *testing.T) {
|
||||
@ -53,7 +53,7 @@ func TestStub(t *testing.T) {
|
||||
t.Errorf("recover: %v, want %v", r, want)
|
||||
}
|
||||
}()
|
||||
new(stubHolder).SkipNow()
|
||||
stubHolder{&Stub[stubHolder]{TB: t}}.SkipNow()
|
||||
})
|
||||
|
||||
t.Run("Skip", func(t *testing.T) {
|
||||
@ -63,7 +63,7 @@ func TestStub(t *testing.T) {
|
||||
t.Errorf("recover: %v, want %v", r, want)
|
||||
}
|
||||
}()
|
||||
new(stubHolder).Skip()
|
||||
stubHolder{&Stub[stubHolder]{TB: t}}.Skip()
|
||||
})
|
||||
|
||||
t.Run("Skipf", func(t *testing.T) {
|
||||
@ -73,7 +73,7 @@ func TestStub(t *testing.T) {
|
||||
t.Errorf("recover: %v, want %v", r, want)
|
||||
}
|
||||
}()
|
||||
new(stubHolder).Skipf("")
|
||||
stubHolder{&Stub[stubHolder]{TB: t}}.Skipf("")
|
||||
})
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user