3 // Copyright 2017 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
20 if r := recover(); r != nil {
21 pcs := make([]uintptr, 10)
22 n := runtime.Callers(0, pcs)
24 frames := runtime.CallersFrames(pcs)
26 f, more := frames.Next()
27 if f.Function == "main.foo" {
28 println("did not expect to see call to foo in stack trace")
41 func bar(x ...int) int {
47 if r := recover(); r != nil {
48 pcs := make([]uintptr, 10)
49 n := runtime.Callers(0, pcs)
51 frames := runtime.CallersFrames(pcs)
53 f, more := frames.Next()
54 if f.Function == "main.bar" {
55 println("did not expect to see call to bar in stack trace")