github.com/goplusjs/gopherjs@v1.2.6-0.20211206034512-f187917453b8/compiler/natives/src/testing/testing.go (about)

     1  // +build js
     2  
     3  package testing
     4  
     5  import "runtime"
     6  
     7  // The upstream callerName and frameSkip rely on runtime.Callers,
     8  // and panic if there are zero callers found. However, runtime.Callers
     9  // is not implemented for GopherJS at this time, so we can't use
    10  // that implementation. Use these stubs instead.
    11  func callerName(skip int) string {
    12  	// Upstream callerName requires a functional runtime.Callers.
    13  	// TODO: Implement if possible.
    14  	return "<unknown>"
    15  }
    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  	}
    26  }