| // Copyright 2014 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| func TestGoroutineLock(t *testing.T) { |
| oldDebug := DebugGoroutines |
| defer func() { DebugGoroutines = oldDebug }() |
| sawPanic := make(chan interface{}) |
| defer func() { sawPanic <- recover() }() |
| g.check() // should panic |
| t.Fatal("did not see panic from check in other goroutine") |
| if !strings.Contains(fmt.Sprint(e), "wrong goroutine") { |
| t.Errorf("expected on see panic about running on the wrong goroutine; got %v", e) |