mirror of
https://github.com/golang/go
synced 2024-11-05 18:36:08 +00:00
testing: print late arriving log line in panic
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>
This commit is contained in:
parent
ae1fa08e41
commit
27684ea195
2 changed files with 2 additions and 2 deletions
|
@ -822,7 +822,7 @@ func TestLogAfterComplete(t *T) {
|
|||
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)
|
||||
}
|
||||
|
|
|
@ -762,7 +762,7 @@ func (c *common) logDepth(s string, depth int) {
|
|||
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 {
|
||||
|
|
Loading…
Reference in a new issue