diff options
| author | Keith Randall <khr@golang.org> | 2014-09-05 10:04:16 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-09-05 10:04:16 -0400 |
| commit | 8217b4a203daaa7f24590f9369c77b758dad1cd6 (patch) | |
| tree | 218976e8656a7f05f539d42417060b5bde4082ee /src/pkg/runtime/stack_test.go | |
| parent | e0f08b938a37490cd6e4f6bb33360678ac5f42b0 (diff) | |
| download | go-8217b4a203daaa7f24590f9369c77b758dad1cd6.tar.xz | |
runtime: convert panic/recover to Go
created panic1.go just so diffs were available.
After this CL is in, I'd like to move panic.go -> defer.go
and panic1.go -> panic.go.
LGTM=rsc
R=rsc, khr
CC=golang-codereviews
https://golang.org/cl/133530045
Diffstat (limited to 'src/pkg/runtime/stack_test.go')
| -rw-r--r-- | src/pkg/runtime/stack_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pkg/runtime/stack_test.go b/src/pkg/runtime/stack_test.go index a822d73db4..7b9412af42 100644 --- a/src/pkg/runtime/stack_test.go +++ b/src/pkg/runtime/stack_test.go @@ -350,3 +350,18 @@ func TestStackAllOutput(t *testing.T) { t.Errorf("Stack output should begin with \"goroutine \"") } } + +func TestStackPanic(t *testing.T) { + // Test that stack copying copies panics correctly. This is difficult + // to test because it is very unlikely that the stack will be copied + // in the middle of gopanic. But it can happen. + // To make this test effective, edit panic.go:gopanic and uncomment + // the GC() call just before freedefer(d). + defer func() { + if x := recover(); x == nil { + t.Errorf("recover failed") + } + }() + useStack(32) + panic("test panic") +} |
