diff options
Diffstat (limited to 'libgo/go/runtime/debug/stack_test.go')
-rw-r--r-- | libgo/go/runtime/debug/stack_test.go | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/libgo/go/runtime/debug/stack_test.go b/libgo/go/runtime/debug/stack_test.go index 263d7155997..0f769ee6cab 100644 --- a/libgo/go/runtime/debug/stack_test.go +++ b/libgo/go/runtime/debug/stack_test.go @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package debug +package debug_test import ( + . "runtime/debug" "strings" "testing" ) @@ -22,16 +23,19 @@ func (t T) method() []byte { The traceback should look something like this, modulo line numbers and hex constants. Don't worry much about the base levels, but check the ones in our own package. - /Users/r/go/src/pkg/runtime/debug/stack_test.go:15 (0x13878) - (*T).ptrmethod: return Stack() - /Users/r/go/src/pkg/runtime/debug/stack_test.go:18 (0x138dd) - T.method: return t.ptrmethod() - /Users/r/go/src/pkg/runtime/debug/stack_test.go:23 (0x13920) - TestStack: b := T(0).method() - /Users/r/go/src/pkg/testing/testing.go:132 (0x14a7a) - tRunner: test.F(t) - /Users/r/go/src/pkg/runtime/proc.c:145 (0xc970) - ???: runtimeĀ·unlock(&runtimeĀ·sched); + goroutine 10 [running]: + runtime/debug.Stack(0x0, 0x0, 0x0) + /Users/r/go/src/runtime/debug/stack.go:28 +0x80 + runtime/debug.(*T).ptrmethod(0xc82005ee70, 0x0, 0x0, 0x0) + /Users/r/go/src/runtime/debug/stack_test.go:15 +0x29 + runtime/debug.T.method(0x0, 0x0, 0x0, 0x0) + /Users/r/go/src/runtime/debug/stack_test.go:18 +0x32 + runtime/debug.TestStack(0xc8201ce000) + /Users/r/go/src/runtime/debug/stack_test.go:37 +0x38 + testing.tRunner(0xc8201ce000, 0x664b58) + /Users/r/go/src/testing/testing.go:456 +0x98 + created by testing.RunTests + /Users/r/go/src/testing/testing.go:561 +0x86d */ func TestStack(t *testing.T) { b := T(0).method() @@ -41,13 +45,10 @@ func TestStack(t *testing.T) { } n := 0 frame := func(line, code string) { + check(t, lines[n], code) + n++ check(t, lines[n], line) n++ - // The source might not be available while running the test. - if strings.HasPrefix(lines[n], "\t") { - check(t, lines[n], code) - n++ - } } frame("stack_test.go", "\tmethod.N15_runtime_debug.T: return Stack()") frame("stack_test.go", "\tmethod.N15_runtime_debug.T: return t.ptrmethod()") |