diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-03-26 16:50:58 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-03-26 16:50:58 +0200 |
commit | 519725bb3c075ee2462c929f5997cb068e18466a (patch) | |
tree | 5b162e8488ad147a645048c073577821b4a2bee9 /src/pkg/runtime/debug/stack_test.go | |
parent | 842623c5dd2819d980ca9c58048d6bc6ed82475f (diff) | |
download | golang-upstream-weekly/2012.03.22.tar.gz |
Imported Upstream version 2012.03.22upstream-weekly/2012.03.22
Diffstat (limited to 'src/pkg/runtime/debug/stack_test.go')
-rw-r--r-- | src/pkg/runtime/debug/stack_test.go | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/pkg/runtime/debug/stack_test.go b/src/pkg/runtime/debug/stack_test.go index 94293bb93..f33f5072b 100644 --- a/src/pkg/runtime/debug/stack_test.go +++ b/src/pkg/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) { |