aboutsummaryrefslogtreecommitdiff
path: root/src/testing/panic_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/panic_test.go')
-rw-r--r--src/testing/panic_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/testing/panic_test.go b/src/testing/panic_test.go
index 1c42f9f8dd..fc84175ee6 100644
--- a/src/testing/panic_test.go
+++ b/src/testing/panic_test.go
@@ -34,6 +34,7 @@ func TestPanic(t *testing.T) {
want: `
--- FAIL: TestPanicHelper (N.NNs)
panic_test.go:NNN: TestPanicHelper
+ TestPanicHelper
`,
}, {
desc: "subtest panics",
@@ -41,8 +42,10 @@ func TestPanic(t *testing.T) {
want: `
--- FAIL: TestPanicHelper (N.NNs)
panic_test.go:NNN: TestPanicHelper
+ TestPanicHelper
--- FAIL: TestPanicHelper/1 (N.NNs)
panic_test.go:NNN: TestPanicHelper/1
+ TestPanicHelper/1
`,
}, {
desc: "subtest panics with cleanup",
@@ -53,8 +56,10 @@ ran middle cleanup 1
ran outer cleanup
--- FAIL: TestPanicHelper (N.NNs)
panic_test.go:NNN: TestPanicHelper
+ TestPanicHelper
--- FAIL: TestPanicHelper/1 (N.NNs)
panic_test.go:NNN: TestPanicHelper/1
+ TestPanicHelper/1
`,
}, {
desc: "subtest panics with outer cleanup panic",
@@ -65,6 +70,7 @@ ran middle cleanup 1
ran outer cleanup
--- FAIL: TestPanicHelper (N.NNs)
panic_test.go:NNN: TestPanicHelper
+ TestPanicHelper
`,
}, {
desc: "subtest panics with middle cleanup panic",
@@ -75,8 +81,10 @@ ran middle cleanup 1
ran outer cleanup
--- FAIL: TestPanicHelper (N.NNs)
panic_test.go:NNN: TestPanicHelper
+ TestPanicHelper
--- FAIL: TestPanicHelper/1 (N.NNs)
panic_test.go:NNN: TestPanicHelper/1
+ TestPanicHelper/1
`,
}, {
desc: "subtest panics with inner cleanup panic",
@@ -87,8 +95,10 @@ ran middle cleanup 1
ran outer cleanup
--- FAIL: TestPanicHelper (N.NNs)
panic_test.go:NNN: TestPanicHelper
+ TestPanicHelper
--- FAIL: TestPanicHelper/1 (N.NNs)
panic_test.go:NNN: TestPanicHelper/1
+ TestPanicHelper/1
`,
}, {
desc: "parallel subtest panics with cleanup",
@@ -99,8 +109,10 @@ ran middle cleanup 1
ran outer cleanup
--- FAIL: TestPanicHelper (N.NNs)
panic_test.go:NNN: TestPanicHelper
+ TestPanicHelper
--- FAIL: TestPanicHelper/1 (N.NNs)
panic_test.go:NNN: TestPanicHelper/1
+ TestPanicHelper/1
`,
}, {
desc: "parallel subtest panics with outer cleanup panic",
@@ -111,6 +123,7 @@ ran middle cleanup 1
ran outer cleanup
--- FAIL: TestPanicHelper (N.NNs)
panic_test.go:NNN: TestPanicHelper
+ TestPanicHelper
`,
}, {
desc: "parallel subtest panics with middle cleanup panic",
@@ -121,8 +134,10 @@ ran middle cleanup 1
ran outer cleanup
--- FAIL: TestPanicHelper (N.NNs)
panic_test.go:NNN: TestPanicHelper
+ TestPanicHelper
--- FAIL: TestPanicHelper/1 (N.NNs)
panic_test.go:NNN: TestPanicHelper/1
+ TestPanicHelper/1
`,
}, {
desc: "parallel subtest panics with inner cleanup panic",
@@ -133,8 +148,10 @@ ran middle cleanup 1
ran outer cleanup
--- FAIL: TestPanicHelper (N.NNs)
panic_test.go:NNN: TestPanicHelper
+ TestPanicHelper
--- FAIL: TestPanicHelper/1 (N.NNs)
panic_test.go:NNN: TestPanicHelper/1
+ TestPanicHelper/1
`,
}}
for _, tc := range testCases {
@@ -165,6 +182,7 @@ func TestPanicHelper(t *testing.T) {
return
}
t.Log(t.Name())
+ t.Output().Write([]byte(t.Name()))
if t.Name() == *testPanicTest {
panic("panic")
}
@@ -195,6 +213,7 @@ func TestPanicHelper(t *testing.T) {
t.Parallel()
}
t.Log(t.Name())
+ t.Output().Write([]byte(t.Name()))
if chosen {
if *testPanicCleanup {
t.Cleanup(func() {