-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.release-blocker
Milestone
Description
This is the test program.
package main_test
import (
"testing"
)
func TestHelper(t *testing.T) {
helperA(t)
}
func helperA(t *testing.T) {
t.Helper()
t.Run("subtest", func(t *testing.T) {
t.Helper()
t.Fatal("fatal error message")
})
}
When run using go test foo_test.go
with Go 1.14 or Go 1.15, this program prints
--- FAIL: TestHelper (0.00s)
--- FAIL: TestHelper/subtest (0.00s)
foo_test.go:8: fatal error message
FAIL
FAIL command-line-arguments 0.009s
FAIL
When run with Go 1.16 it prints
--- FAIL: TestHelper (0.00s)
--- FAIL: TestHelper/subtest (0.00s)
foo_test.go:14: fatal error message
FAIL
FAIL command-line-arguments 0.007s
FAIL
The line number has changed from 8 to 14. Line number 14 is in a function that called t.Helper
, so line 8 seems correct and line 14 seems wrong.
This appears to be due to https://golang.org/cl/231717. If I revert that CL, I see line number 8.
CC @bboreham
dnephin, dmitshur and hgsgtkbboreham
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.release-blocker