aboutsummaryrefslogtreecommitdiff
path: root/src/testing/sub_test.go
diff options
context:
space:
mode:
authorMarcel van Lohuizen <mpvl@golang.org>2016-05-21 14:37:29 +0200
committerMarcel van Lohuizen <mpvl@golang.org>2016-05-24 16:27:47 +0000
commit7b9d3ff4cbd93c0b9e69c78cbb2cb891839c7fb3 (patch)
tree2d4349544099abf604465ea3ff1ba9e0acf6ad04 /src/testing/sub_test.go
parentdcc42c7d11ad06bebc9d13d1e812629f930f14a7 (diff)
downloadgo-7b9d3ff4cbd93c0b9e69c78cbb2cb891839c7fb3.tar.xz
testing: don't be silent if a test's goroutine fails a test after test exits
Fixes #15654 Change-Id: I9bdaa9b76d480d75f24d95f0235efd4a79e3593e Reviewed-on: https://go-review.googlesource.com/23320 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Marcel van Lohuizen <mpvl@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Diffstat (limited to 'src/testing/sub_test.go')
-rw-r--r--src/testing/sub_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/testing/sub_test.go b/src/testing/sub_test.go
index 2804550737..2a24aaacfd 100644
--- a/src/testing/sub_test.go
+++ b/src/testing/sub_test.go
@@ -307,6 +307,27 @@ func TestTRun(t *T) {
f: func(t *T) {
t.Skip()
},
+ }, {
+ desc: "panic on goroutine fail after test exit",
+ ok: false,
+ maxPar: 4,
+ f: func(t *T) {
+ ch := make(chan bool)
+ t.Run("", func(t *T) {
+ go func() {
+ <-ch
+ defer func() {
+ if r := recover(); r == nil {
+ realTest.Errorf("expected panic")
+ }
+ ch <- true
+ }()
+ t.Errorf("failed after success")
+ }()
+ })
+ ch <- true
+ <-ch
+ },
}}
for _, tc := range testCases {
ctx := newTestContext(tc.maxPar, newMatcher(regexp.MatchString, "", ""))