Permalink
Browse files

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.
  • Loading branch information...
dmitshur committed Jun 27, 2018
1 parent 1a7431c commit 004a367dd87a5eec06ebc7c92d122cf90944ac29
Showing with 12 additions and 4 deletions.
  1. +12 −4 compiler/natives/src/testing/testing.go
@@ -2,6 +2,8 @@
package testing
import "runtime"
// The upstream callerName and frameSkip rely on runtime.Callers,
// and panic if there are zero callers found. However, runtime.Callers
// is not implemented for GopherJS at this time, so we can't use
@@ -11,8 +13,14 @@ func callerName(skip int) string {
// TODO: Implement if possible.
return "<unknown>"
}
func (*common) frameSkip(skip int) int {
// Upstream frameSkip requires a functional runtime.Callers.
// TODO: Implement if possible.
return skip
func (*common) frameSkip(skip int) runtime.Frame {
_, file, line, ok := runtime.Caller(skip)
if !ok {
return runtime.Frame{}
}
return runtime.Frame{
File: file,
Line: line,
}
}

0 comments on commit 004a367

Please sign in to comment.