aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing.go')
-rw-r--r--src/testing/testing.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go
index 80354d5ce8..dec39d24da 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -509,6 +509,13 @@ func (c *common) frameSkip(skip int) runtime.Frame {
}
return prevFrame
}
+ // If more helper PCs have been added since we last did the conversion
+ if c.helperNames == nil {
+ c.helperNames = make(map[string]struct{})
+ for pc := range c.helperPCs {
+ c.helperNames[pcToName(pc)] = struct{}{}
+ }
+ }
if _, ok := c.helperNames[frame.Function]; !ok {
// Found a frame that wasn't inside a helper function.
return frame
@@ -521,14 +528,6 @@ func (c *common) frameSkip(skip int) runtime.Frame {
// and inserts the final newline if needed and indentation spaces for formatting.
// This function must be called with c.mu held.
func (c *common) decorate(s string, skip int) string {
- // If more helper PCs have been added since we last did the conversion
- if c.helperNames == nil {
- c.helperNames = make(map[string]struct{})
- for pc := range c.helperPCs {
- c.helperNames[pcToName(pc)] = struct{}{}
- }
- }
-
frame := c.frameSkip(skip)
file := frame.File
line := frame.Line