Skip to content

Commit 9f7f458

Browse files
committed
natives/testing: Update frameSkip signature and implementation.
The scope of frameSkip helper has changed in Go 1.11. Update the function signature and implementation to match. This change helps GopherJS with running tests.
1 parent f2b3fe5 commit 9f7f458

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

compiler/natives/src/testing/testing.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
package testing
44

5+
import "runtime"
6+
57
// The upstream callerName and frameSkip rely on runtime.Callers,
68
// and panic if there are zero callers found. However, runtime.Callers
79
// is not implemented for GopherJS at this time, so we can't use
@@ -11,8 +13,14 @@ func callerName(skip int) string {
1113
// TODO: Implement if possible.
1214
return "<unknown>"
1315
}
14-
func (*common) frameSkip(skip int) int {
15-
// Upstream frameSkip requires a functional runtime.Callers.
16-
// TODO: Implement if possible.
17-
return skip
16+
17+
func (*common) frameSkip(skip int) runtime.Frame {
18+
_, file, line, ok := runtime.Caller(skip)
19+
if !ok {
20+
return runtime.Frame{}
21+
}
22+
return runtime.Frame{
23+
File: file,
24+
Line: line,
25+
}
1826
}

0 commit comments

Comments
 (0)