Home | History | Annotate | Download | only in issue19467.dir
      1 // Copyright 2017 The Go Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style
      3 // license that can be found in the LICENSE file.
      4 
      5 package main
      6 
      7 import (
      8 	"./mysync"
      9 	"log"
     10 	"runtime"
     11 )
     12 
     13 func main() {
     14 	var wg mysync.WaitGroup
     15 	wg.Done()
     16 	ci := runtime.CallersFrames(wg.Callers)
     17 	frames := make([]runtime.Frame, 0, 4)
     18 	for {
     19 		frame, more := ci.Next()
     20 		frames = append(frames, frame)
     21 		if !more {
     22 			break
     23 		}
     24 	}
     25 	expecting := []string{
     26 		"mysync.(*WaitGroup).Add",
     27 		"mysync.(*WaitGroup).Done",
     28 	}
     29 	for i := 0; i < 2; i++ {
     30 		if frames[i].Function != expecting[i] {
     31 			log.Fatalf("frame %d: got %s, want %s", i, frames[i].Function, expecting[i])
     32 		}
     33 	}
     34 }
     35