diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2012-04-03 10:55:16 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2012-04-03 10:55:16 -0700 |
commit | 6a14926b44504e88488e3715b5b84928d454fb49 (patch) | |
tree | 9cf5f80773922c62ebd9ba07388a1f27354dc516 /libgo/go/runtime/debug/stack_test.go | |
parent | aabd700dee5d71eb0a8180fb3626a23da9a88fdd (diff) | |
parent | 749dea2a0549c126a0e992a6dd8e9b5eb28e1cee (diff) | |
download | gcc-hjl/x32/java.tar.gz |
Merge remote-tracking branch 'origin/master' into hjl/x32/javahjl/x32/java
Diffstat (limited to 'libgo/go/runtime/debug/stack_test.go')
-rw-r--r-- | libgo/go/runtime/debug/stack_test.go | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/libgo/go/runtime/debug/stack_test.go b/libgo/go/runtime/debug/stack_test.go index 94293bb934b..f33f5072b40 100644 --- a/libgo/go/runtime/debug/stack_test.go +++ b/libgo/go/runtime/debug/stack_test.go @@ -39,13 +39,20 @@ func TestStack(t *testing.T) { if len(lines) <= 6 { t.Fatal("too few lines") } - check(t, lines[0], "src/pkg/runtime/debug/stack_test.go") - check(t, lines[1], "\t(*T).ptrmethod: return Stack()") - check(t, lines[2], "src/pkg/runtime/debug/stack_test.go") - check(t, lines[3], "\tT.method: return t.ptrmethod()") - check(t, lines[4], "src/pkg/runtime/debug/stack_test.go") - check(t, lines[5], "\tTestStack: b := T(0).method()") - check(t, lines[6], "src/pkg/testing/testing.go") + n := 0 + frame := func(line, code string) { + 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("src/pkg/runtime/debug/stack_test.go", "\t(*T).ptrmethod: return Stack()") + frame("src/pkg/runtime/debug/stack_test.go", "\tT.method: return t.ptrmethod()") + frame("src/pkg/runtime/debug/stack_test.go", "\tTestStack: b := T(0).method()") + frame("src/pkg/testing/testing.go", "") } func check(t *testing.T, line, has string) { |