...
1[short] skip
2[!race] skip
3
4go test -v -race
5stdout 'testing_test.go:26: directCall'
6stdout 'testing_test.go:27: interfaceTBCall'
7stdout 'testing_test.go:28: interfaceCall'
8
9-- go.mod --
10module 26995-TBHelper-line-number
11
12go 1.21
13-- testing_test.go --
14package testing_test
15
16import "testing"
17
18type TestingT interface {
19 Helper()
20 Log(args ...interface{})
21}
22
23func directCall(t *testing.T) {
24 t.Helper()
25 t.Log("directCall")
26}
27
28func interfaceTBCall(t testing.TB) {
29 t.Helper()
30 t.Log("interfaceTBCall")
31}
32
33func interfaceCall(t TestingT) {
34 t.Helper()
35 t.Log("interfaceCall")
36}
37
38func TestTesting(t *testing.T) {
39 directCall(t)
40 interfaceTBCall(t)
41 interfaceCall(t)
42}
View as plain text