When you log after a test has completed,
the testing package panics.
Print the logged line as part of that panic,
to aid in debugging.
Change-Id: I3d6689d1eed57c03e300afe37db0c15b2f4acda4
Reviewed-on: https://go-review.googlesource.com/c/go/+/283972
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
c2 <- fmt.Sprintf("subtest panic with unexpected value %v", p)
return
}
- const want = "Log in goroutine after TestLateLog has completed"
+ const want = "Log in goroutine after TestLateLog has completed: log after test"
if !strings.Contains(s, want) {
c2 <- fmt.Sprintf("subtest panic %q does not contain %q", s, want)
}
return
}
}
- panic("Log in goroutine after " + c.name + " has completed")
+ panic("Log in goroutine after " + c.name + " has completed: " + s)
} else {
if c.chatty != nil {
if c.bench {